My Second Day of Coding and I Built a Quaternion-Powered Sentiment Engine

Two days ago, I barely knew how to string together Python lines by myself. Today, I trained a custom neural network with quaternion embeddings and attention pooling to classify emotional sentiment in language—and it works. This isn't just about achieving high accuracy. It's about building something that understands people.

What I Built

I designed a sentiment analysis model using quaternion mathematics (four-dimensional number systems) instead of traditional embeddings, giving the model a richer sense of linguistic structure. Then I added a custom attention layer to help it focus on emotionally significant words, rather than averaging everything out equally.


Technologies Used:


TensorFlow / Keras


HuggingFace Datasets (IMDb)


Custom QuaternionEmbedding Layer


AttentionPooling Layer



Results That Prove It Works

I trained the model on 25,000 IMDb reviews (balanced between positive and negative). Validation accuracy reached:


Epoch 5 Accuracy: ~86%


Validation Accuracy: ~82%



Then I tested it:


Clear Positive Review: 99% positive


Clear Negative Review: 3% positive (i.e. 97% negative)


Neutral Review: 50% — perfectly balanced


Ambiguous Positive: ~70%


Ambiguous Negative: ~28%



These numbers don’t just show accuracy; they show nuance. This model understands emotional ambiguity, which is rare for sentiment models.


Why This Matters

I didn’t follow a tutorial. I asked questions, I tested, I failed, and I rebuilt. The idea was born from curiosity: what if embeddings weren’t just numbers? What if they had structure? And what if that structure could make machines feel tone shifts, sarcasm, neutrality? On my second day coding alone, I proved that they can.


What I Want to Build Next

This is just a prototype. I want to:


Train on 1M+ real-world emotional reviews


Publish the model on HuggingFace for public use


Build a web app that reads mood in live conversation

Collaborate with anyone building emotionally-aware AI

I'm not a seasoned developer, yet. But I built a working concept in 48 hours. So imagine what happens next week.

If you’re a researcher, dev, or dreamer who wants to help make AI more emotionally aware. I’m in!

Model built by Julia HunterPowered by intuition, persistence, and the quaternion spirit.


Comments

Popular posts from this blog

Starting over

Week 13 part B

WEEK 8