Skip to content

Add OpenPsi emotion layer#18

Merged
Nahom32 merged 3 commits into
iCog-Labs-Dev:mainfrom
Rekhii:feature/openpsi-emotions
Jun 19, 2026
Merged

Add OpenPsi emotion layer#18
Nahom32 merged 3 commits into
iCog-Labs-Dev:mainfrom
Rekhii:feature/openpsi-emotions

Conversation

@Rekhii

@Rekhii Rekhii commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

This adds emotion support based on the OpenPsi paper (Cai et al. 2013, Sec 4.3). The system already tracks modulator values; this reads them and works out which emotion is felt — happy, sad, angry, or fear.

What was added

  • openpsi/config.metta: the emotion table (Table 2) and fuzzy-logic constants
  • core/helpers.py + core/helper.metta: three fuzzy functions (eqs. 2, 16, 17)
  • openpsi/feeling.metta: the emotion logic — intensity per emotion (eq. 14), the membership function (eq. 15), and dominant-emotion selection with the gamma threshold
  • openpsi/tests/feeling_tests.metta: 22 unit tests

Design notes

  • The paper's "pleasure" dimension is mapped to the existing valence modulator (as agreed), so the modulator vector is unchanged.
  • Implemented at alpha=50 as the formula states. The paper's printed example intensities don't reproduce from its own formula at any single alpha, so the tests assert the correct dominant emotion (Happy) at the paper's example levels rather than the exact printed number.

How to run the tests

petta openpsi/tests/feeling_tests.metta

Rekhii added 2 commits June 17, 2026 07:16
- Rename emotionP -> indicatorMembership for clarity (per review)
- Add openpsi/tests/feeling_tests.metta: 22 unit tests covering fuzzy
  primitives, indicatorMembership per indicator case, Table 2 lookups,
  emotion intensities (paper Table 3 levels), and dominant emotion + gamma.
  All 22 pass.
Comment thread core/helpers.py
Comment thread openpsi/config.metta
Add (: EmotionIndex ...) and (: EmotionModulator ...) type declarations
matching core/state.metta style, per review feedback.
@Nahom32 Nahom32 merged commit 624605c into iCog-Labs-Dev:main Jun 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants