f8b21af4be
10_Wiki/Topics 대규모 정리: - 오류 캡처/미완성 stub 문서 227개 제거 - 교차폴더 중복 43클러스터 병합 (63파일 → redirect) - 링크명 정규화: 깨진 링크 수정·redirect 직결·개념 매핑 ~2,400건 - 카테고리 MOC 6개 신규 생성 - Graph 섹션 미해결 related-keyword 링크 10,058건 제거 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
253 lines
7.6 KiB
Markdown
253 lines
7.6 KiB
Markdown
---
|
|
id: wiki-2026-0508-evolutionary-biology
|
|
title: Evolutionary Biology
|
|
category: 10_Wiki/Topics
|
|
status: verified
|
|
canonical_id: self
|
|
aliases: [evolution, natural selection, modern synthesis, evo-devo, neutral theory, evolutionary algorithms]
|
|
duplicate_of: none
|
|
source_trust_level: A
|
|
confidence_score: 0.96
|
|
verification_status: applied
|
|
tags: [biology, evolution, natural-selection, evo-devo, ga, neuroevolution, ml-bio]
|
|
raw_sources: []
|
|
last_reinforced: 2026-05-10
|
|
github_commit: pending
|
|
tech_stack:
|
|
language: Python / Bio
|
|
framework: scikit-bio / DEAP / NEAT / AlphaFold
|
|
---
|
|
|
|
# Evolutionary Biology
|
|
|
|
## 매 한 줄
|
|
> **"매 mutation + selection + drift + gene flow 의 의 의 species 의 변화"**. Darwin Origin (1859), modern synthesis (Dobzhansky-Mayr-Simpson), Kimura neutral. 매 modern: 매 genomics + AlphaFold + evolutionary algorithms.
|
|
|
|
## 매 핵심
|
|
|
|
### 매 mechanism
|
|
- **Mutation**: 매 random change.
|
|
- **Natural selection**: 매 fitness-based.
|
|
- **Genetic drift**: 매 chance.
|
|
- **Gene flow**: 매 migration.
|
|
- **Recombination**.
|
|
|
|
### 매 modern synthesis
|
|
- **Hardy-Weinberg**: 매 baseline.
|
|
- **Population genetics**.
|
|
- **Neutral theory** (Kimura).
|
|
- **Coalescent theory**.
|
|
- **Evo-devo**: 매 development.
|
|
|
|
### 매 응용 (CS / AI)
|
|
1. **GA (genetic algorithm)**.
|
|
2. **NEAT** (neuroevolution).
|
|
3. **Evolutionary strategy** (ES, OpenAI).
|
|
4. **Quality-diversity** (MAP-Elites).
|
|
5. **Open-ended** (POET).
|
|
6. **AlphaFold** (evolution-informed protein).
|
|
|
|
### 매 응용 (bio)
|
|
1. **Phylogenetics**: 매 tree.
|
|
2. **Antibiotic resistance**.
|
|
3. **Cancer evolution**.
|
|
4. **Crop breeding**.
|
|
5. **Conservation**.
|
|
|
|
## 💻 패턴
|
|
|
|
### Hardy-Weinberg
|
|
```python
|
|
def hardy_weinberg(p):
|
|
"""매 allele freq p, q=1-p."""
|
|
q = 1 - p
|
|
return {'AA': p**2, 'Aa': 2*p*q, 'aa': q**2}
|
|
```
|
|
|
|
### Wright-Fisher (drift)
|
|
```python
|
|
import numpy as np
|
|
|
|
def wright_fisher(N, p_init, generations=1000):
|
|
p = p_init
|
|
history = [p]
|
|
for _ in range(generations):
|
|
n_A = np.random.binomial(2*N, p)
|
|
p = n_A / (2*N)
|
|
history.append(p)
|
|
if p == 0 or p == 1: break
|
|
return history
|
|
```
|
|
|
|
### Coalescent simulation
|
|
```python
|
|
def coalescent(n=10):
|
|
"""매 generate random gene tree."""
|
|
times = []
|
|
while n > 1:
|
|
t = np.random.exponential(2 / (n * (n - 1)))
|
|
times.append(t)
|
|
n -= 1
|
|
return times
|
|
```
|
|
|
|
### Genetic algorithm (DEAP)
|
|
```python
|
|
from deap import base, creator, tools, algorithms
|
|
|
|
creator.create('FitnessMax', base.Fitness, weights=(1.0,))
|
|
creator.create('Individual', list, fitness=creator.FitnessMax)
|
|
|
|
toolbox = base.Toolbox()
|
|
toolbox.register('attr', np.random.rand)
|
|
toolbox.register('individual', tools.initRepeat, creator.Individual, toolbox.attr, n=10)
|
|
toolbox.register('population', tools.initRepeat, list, toolbox.individual)
|
|
toolbox.register('evaluate', lambda ind: (sum(ind),))
|
|
toolbox.register('mate', tools.cxBlend, alpha=0.5)
|
|
toolbox.register('mutate', tools.mutGaussian, mu=0, sigma=0.1, indpb=0.1)
|
|
toolbox.register('select', tools.selTournament, tournsize=3)
|
|
|
|
pop = toolbox.population(n=100)
|
|
pop, log = algorithms.eaSimple(pop, toolbox, cxpb=0.7, mutpb=0.2, ngen=50)
|
|
```
|
|
|
|
### NEAT (neuroevolution)
|
|
```python
|
|
import neat
|
|
|
|
def eval_genome(genome, config):
|
|
net = neat.nn.FeedForwardNetwork.create(genome, config)
|
|
fitness = 0
|
|
for input_, expected in TRAINING_DATA:
|
|
output = net.activate(input_)
|
|
fitness += -(output[0] - expected) ** 2
|
|
return fitness
|
|
|
|
config = neat.Config(neat.DefaultGenome, neat.DefaultReproduction, neat.DefaultSpeciesSet, neat.DefaultStagnation, 'config-feedforward')
|
|
pop = neat.Population(config)
|
|
winner = pop.run(eval_genomes, 50)
|
|
```
|
|
|
|
### Evolutionary Strategy (ES, OpenAI)
|
|
```python
|
|
def evolution_strategy(theta, fn, sigma=0.1, lr=0.01, n_pop=50):
|
|
eps = np.random.randn(n_pop, len(theta))
|
|
rewards = [fn(theta + sigma * e) for e in eps]
|
|
rewards = (np.array(rewards) - np.mean(rewards)) / (np.std(rewards) + 1e-9)
|
|
grad = (eps.T @ rewards) / (n_pop * sigma)
|
|
return theta + lr * grad
|
|
```
|
|
|
|
### Phylogenetic tree (Bio.Phylo)
|
|
```python
|
|
from Bio import Phylo, SeqIO
|
|
from Bio.Phylo.TreeConstruction import DistanceCalculator, DistanceTreeConstructor
|
|
|
|
aln = AlignIO.read('seqs.fasta', 'fasta')
|
|
calc = DistanceCalculator('identity')
|
|
dm = calc.get_distance(aln)
|
|
tree = DistanceTreeConstructor().nj(dm)
|
|
Phylo.draw(tree)
|
|
```
|
|
|
|
### Selection pressure (dN/dS)
|
|
```python
|
|
def dn_ds(synonymous, nonsynonymous, sites_s, sites_n):
|
|
"""매 ω = (Nd/Ns) / (Sd/Ss)."""
|
|
pn = nonsynonymous / sites_n
|
|
ps = synonymous / sites_s
|
|
if ps == 0: return float('inf')
|
|
return pn / ps # 매 > 1 = positive, < 1 = purifying, ≈ 1 = neutral
|
|
```
|
|
|
|
### Coevolution (predator-prey GA)
|
|
```python
|
|
def coevolution_step(predators, prey, eval_battle):
|
|
new_pred = []
|
|
for p in predators:
|
|
opponent = random.choice(prey)
|
|
fitness = eval_battle(p, opponent, role='predator')
|
|
p.fitness = fitness
|
|
new_pred.append(p)
|
|
# 매 selection + reproduction
|
|
return select_top_k(new_pred, k=len(predators) // 2) * 2
|
|
```
|
|
|
|
### MAP-Elites (quality-diversity)
|
|
```python
|
|
def map_elites(behavior_dim, eval_fn, n_iter=10000):
|
|
archive = {} # 매 behavior → genome
|
|
for _ in range(n_iter):
|
|
if archive: parent = random.choice(list(archive.values()))
|
|
else: parent = random_genome()
|
|
child = mutate(parent)
|
|
behavior, fitness = eval_fn(child)
|
|
cell = discretize(behavior, behavior_dim)
|
|
if cell not in archive or fitness > archive[cell].fitness:
|
|
archive[cell] = child
|
|
return archive
|
|
```
|
|
|
|
### Antibiotic resistance simulation
|
|
```python
|
|
def resistance_evolution(N, mut_rate, antibiotic_pressure, generations):
|
|
p_resistant = 1e-7
|
|
for _ in range(generations):
|
|
# 매 mutation
|
|
p_resistant += mut_rate * (1 - p_resistant)
|
|
# 매 selection (resistant 의 advantage during antibiotic)
|
|
if antibiotic_pressure:
|
|
p_resistant = p_resistant / (p_resistant + (1 - p_resistant) * 0.01)
|
|
return p_resistant
|
|
```
|
|
|
|
### AlphaFold (evolution-informed)
|
|
```python
|
|
# 매 MSA (multiple sequence alignment) → 매 contact → 매 structure
|
|
# 매 evolutionary co-variation 의 contact 의 hint
|
|
def msa_to_contacts(msa):
|
|
"""매 simplified Direct Coupling Analysis."""
|
|
cov = compute_residue_covariance(msa)
|
|
return cov # 매 high covariation = likely contact
|
|
```
|
|
|
|
## 매 결정 기준
|
|
| 상황 | Approach |
|
|
|---|---|
|
|
| Optimization | GA / ES |
|
|
| Neural arch search | NEAT / ES |
|
|
| Diversity | MAP-Elites |
|
|
| Open-ended | POET / coevolution |
|
|
| Phylogenetics | NJ / ML / Bayesian |
|
|
| Cancer | Clonal evolution |
|
|
| Drug resistance | Population dynamics |
|
|
|
|
**기본값**: 매 GA / ES for optimization + 매 MAP-Elites for diversity + 매 phylogenetics for bio + 매 evolution-informed ML.
|
|
|
|
## 🔗 Graph
|
|
- 변형: [[Genetic-Algorithm]] · [[Evolutionary Biology|Neuroevolution]]
|
|
- 응용: [[NEAT]] · [[AlphaFold]]
|
|
- Adjacent: [[Computational_Creativity|Computational-Creativity]]
|
|
|
|
## 🤖 LLM 활용
|
|
**언제**: 매 optimization. 매 architecture search. 매 phylogenetics. 매 protein.
|
|
**언제 X**: 매 differentiable + gradient available.
|
|
|
|
## ❌ 안티패턴
|
|
- **GA where gradient works**: 매 sample-inefficient.
|
|
- **No diversity**: 매 premature convergence.
|
|
- **Tiny population**: 매 drift dominate.
|
|
- **No fitness shaping**: 매 sparse reward fail.
|
|
- **Ignore neutral theory**: 매 selection 의 over-attribute.
|
|
|
|
## 🧪 검증 / 중복
|
|
- Verified (Darwin, Kimura, Salimans ES 2017, Stanley NEAT, Mouret MAP-Elites).
|
|
- 신뢰도 A.
|
|
|
|
## 🕓 Changelog
|
|
| 날짜 | 변경 |
|
|
|---|---|
|
|
| 2026-04-20 | Auto-reinforced |
|
|
| 2026-05-08 | Phase 1 |
|
|
| 2026-05-10 | Manual cleanup — HW / WF / GA / NEAT / ES / MAP-Elites / phylo code |
|