Close

Log #1: Finding New Approaches

A project log for rin

using machine learning to build connections between emotions

qquuiinnqquuiinn 12/21/2017 at 20:160 Comments

I've been spending a lot of time with Wikipedia trying to figure some details out about this project:


First, using an NN may not be the best idea. It requires training data, and I don't think it would be the best idea to hand off an emotional model to somebody else to train, because I'm trying to get everything to emotionally adapt to the user, rather than have the user conform to someone else's. Instead, I'm trying to get something closer to grouping: grouping emotions together so that the learning model can infer other emotions. For example, if the user is feeling lonely, the model can infer that they're also feeling depressed. 

The best way to pull that off, then, is to use hierarchical clustering to build a hierarchy of clusters. One cluster (emotion) can then be related to other clusters through linkage, measuring the euclidian distance between points to organize many emotions into only a few. Data would be stored in a distance matrix, which has a numerical value for the relatedness of two emotions. For example, the intersection between lonely and depressed would have a higher score than the intersection on the chart between lonely and hungry. You could also visualize it as a map with lines connecting different nodes, each connection scored based on strength. I'm still a little fuzzy on it, but I'll spend some more time researching.

An alternative would be using the distance matrix, but focusing on single linkages which eliminates the need for an algorithm. That model would be less complex with inferences, but easier to implement with less false conclusions. 

On the user input side of things, I found EARL, or the Emotion Annotation and Representation Language, which was designed to add emotion data to XML so computers could read it. EARL defines 48 simple human emotions, so I think that's a good start. The model will be asking "Do you feel X?" with X substituted for the emotion in question. As the distance matrix gets better and better, questions would be asked that follow well-known connections, as well as less-known connections between emotions to verify that they are still connected or not connected. 

Building a distance matrix with all 48 EARL emotions and a floating point number in each matrix cell representing the average connectedness between two emotions would require 9216 bytes of data, or 18KB. Assuming I do all calculations in RAM, which would be faster than using an external flash chip, I would have to use a Teensy 3.2, which has 64KB of RAM. The LC has 8K, and the Arduino (ATMEGA328) has 2K, which isn't enough. I'll probably go with a 32 bit microcontroller anyway to speed up all the floating point math, but RAM will definitely be a pain point. I could, of course, just toss in a raspberry pi zero with python and an ML library, but where's the fun in that? It's possible I could get away with external SRAM or FRAM and constantly pull data over the SPI bus if that's fast enough. And half the emotions, 24, would squeeze the table just under 5K, enough for the LC assuring I don't use any other floating point numbers. 

Discussions