Body Schema — Efference Copy & Forward Model
The creature learns the mapping from motor commands to expected sensory changes (von Holst 1950). Discrepancy between prediction and reality = anomaly.
Forward Model
predicted_change = W @ motor_command + bias error = actual_change - predicted_change W += lr × outer(error, motor_command)
Online gradient descent. Per-joint confidence tracks prediction accuracy, only updated when joint is active (>0.05).
Anomaly Detection
Max error > 0.3 → anomaly flag → consistency checker → exploration boost.
References
- von Holst & Mittelstaedt (1950). Das Reafferenzprinzip. Naturwissenschaften
- Wolpert & Ghahramani (2000). Computational principles of movement neuroscience. Nature Neuroscience
API Reference
BodySchema(n_joints, n_sensors, config)
update(motor_command, current_sensors, previous_sensors) → dict
Returns prediction_error, anomaly, body_confidence, is_anomalous.
get_body_confidence() → float
Mean joint confidence (0–1).
BodySchemaConfig
learning_rate: 0.05 anomaly_threshold: 0.3 confidence_decay: 0.999