viva_emotion/pad

PAD Model - Pleasure, Arousal, Dominance

The “blood type” of emotional state.

Theory

Three-dimensional affective space (Mehrabian & Russell, 1974; Mehrabian, 1996):

Note on P-D Correlation

Bakker et al. (2014) found P-D correlation ≈ 0.85 in some studies. This implementation treats dimensions as independent (standard approach), but be aware they may not be perfectly orthogonal empirically.

References

Types

Core emotional state. All values bounded to [-1.0, 1.0].

pub type Pad {
  Pad(pleasure: Float, arousal: Float, dominance: Float)
}

Constructors

  • Pad(pleasure: Float, arousal: Float, dominance: Float)

Values

pub fn add(a: Pad, b: Pad) -> Pad

Add two PAD states (for applying deltas).

Examples

add(new(0.5, 0.0, 0.0), new(0.3, 0.2, -0.1))
// -> Pad(pleasure: 0.8, arousal: 0.2, dominance: -0.1)
pub fn distance(a: Pad, b: Pad) -> Float

Euclidean distance between two PAD states.

Examples

distance(neutral(), new(1.0, 0.0, 0.0))
// -> 1.0
distance(neutral(), neutral())
// -> 0.0
pub fn is_suspicious_uniform(noise: Pad) -> Bool

Check if noise is suspiciously uniform (all in [-1,1]). Returns True if noise looks like it might be uniform, not Gaussian.

N(0,1) has ~68% in [-1,1], so all 3 in range is only ~31%.

Examples

is_suspicious_uniform(Pad(pleasure: 0.5, arousal: -0.3, dominance: 0.8))
// -> True
is_suspicious_uniform(Pad(pleasure: 2.1, arousal: -0.3, dominance: 0.8))
// -> False
pub fn is_valid_noise(noise: Pad) -> Bool

Validate that noise looks like N(0,1) samples. Returns True if all components are within plausible range. This is a sanity check, not a statistical test.

Examples

is_valid_noise(Pad(pleasure: 0.5, arousal: -0.3, dominance: 1.2))
// -> True
is_valid_noise(Pad(pleasure: 10.0, arousal: 0.0, dominance: 0.0))
// -> False
pub fn lerp(from: Pad, to: Pad, t: Float) -> Pad

Linear interpolation between two PAD states.

Examples

lerp(neutral(), new(1.0, 1.0, 1.0), 0.5)
// -> Pad(pleasure: 0.5, arousal: 0.5, dominance: 0.5)
lerp(new(-1.0, 0.0, 0.0), new(1.0, 0.0, 0.0), 0.25)
// -> Pad(pleasure: -0.5, arousal: 0.0, dominance: 0.0)
pub fn neutral() -> Pad

Neutral state - emotional equilibrium.

Examples

neutral()
// -> Pad(pleasure: 0.0, arousal: 0.0, dominance: 0.0)
pub fn new(
  pleasure: Float,
  arousal: Float,
  dominance: Float,
) -> Pad

Create a new PAD state (automatically clamped to [-1, 1]).

Examples

new(0.5, 0.3, -0.2)
// -> Pad(pleasure: 0.5, arousal: 0.3, dominance: -0.2)
new(2.0, -3.0, 0.5)
// -> Pad(pleasure: 1.0, arousal: -1.0, dominance: 0.5)
pub fn scale(pad: Pad, factor: Float) -> Pad

Scale a PAD state by a factor.

Examples

scale(new(0.4, 0.2, -0.6), 0.5)
// -> Pad(pleasure: 0.2, arousal: 0.1, dominance: -0.3)
Search Document