Welvet examples

33. systems/dna

Open original example ↗Recorded results · not a live execution

Part: V · Systems
Package: github.com/openfluke/welvet/systems/dna
Status: ok — ✅

When

Adaptation, measurement, or evolution (systems/dna).

Where

import "github.com/openfluke/welvet/systems/dna"

cd 33-dna && source ../env.sh && go run .

Why

Quant and train must be measurable as topology/weight fingerprints — DNA detects logic shifts.

What

ExtractDNA, CompareNetworks, CosineSimilarity, FlattenOp / CollectStores across dtype×quant.

Sample output (captured)

{1 map[0,0,0,0:1] []}

Live capture from go run ./cmd/runall on local ../../welvet (exit 0).

Source

Copied from the Welvet feature book examples (openfluke.github.io/welvet/examples/33-dna).

main.go

Download source ↓
package main

import (
	"fmt"

	"github.com/openfluke/welvet/architecture"
	"github.com/openfluke/welvet/core"
	"github.com/openfluke/welvet/layers/dense"
	"github.com/openfluke/welvet/systems/dna"
)

func main() {
	g := architecture.NewGrid(1, 1, 1, 1)
	l, _ := dense.New(4, 4, core.ActivationLinear, core.DTypeFloat32)
	_ = dense.Place(g, 0, 0, 0, 0, l)
	a := dna.ExtractDNA(g)
	fmt.Println(dna.CompareNetworks(a, a))
}