Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Python module + R package to predict the reactions to a given text using a pretrained recurrent neural network.
| Date | Stars |
|---|---|
| 2026-07-24 | 300 |
| 2026-07-25 | 300 |
| 2026-07-28 | 300 |
| 2026-07-30 | 300 |
| 2026-07-31 | 300 |
| 2026-08-06 | 300 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
# reactionrnn
reactionrnn is a Python 2/3 module + R package on top of [Keras](https://github.com/fchollet/keras)/[TensorFlow](https://www.tensorflow.org) which can easily predict the proportionate reactions (love, wow, haha, sad, angry) to a given text using a pretrained recurrent neural network.
```python
from reactionrnn import reactionrnn
react = reactionrnn()
react.predict("Happy Mother's Day from the Chicago Cubs!")
```
```
[('love', 0.9765), ('wow', 0.0235), ('haha', 0.0), ('sad', 0.0), ('angry', 0.0)]
```
Unlike traditional sentiment analysis models using tools like [word2vec](https://en.wikipedia.org/wiki/Word2vec)/[doc2vec](https://radimrehurek.com/gensim/models/doc2vec.html), reactionrnn handles text at the character level, allowing it to incorporate capitalization, grammar, text length, and sarcasm in its predictions.
```
> react.predict("This is scary AF!😱😱")
[('wow', 0.9109), ('sad', 0.0891), ('love', 0.0), ('haha', 0.0), ('angry', 0.0)]
```
```
> react.predict("When the soup is too hot 😂😂😂")
[('haha', 0.8568), ('love', 0.1376), ('wow', 0.0056), ('sad', 0.0), ('angry', 0.0)]
```
```
> react.predict("He was only 41.")
[('sad', 1.0), ('love', 0.0), ('wow', 0.0), ('haha', 0.0), ('angry', 0.0)]
```
```
> react.predict("Everyone loves autoplaying videos!")
[('angry', 0.8667), ('wow', 0.1333), ('love', 0.0), ('haha', 0.0), ('sad', 0.0)]
```
As a bonus, the model can encode text as a 256D vector (incorporating grammar/caps/length/punc) which can then be fed into other machine learning/deep learning models.
```
> react.encode("DYING. 😄")
[ 0.0411452 0.87985831 0.31406021, ...]
```
Did I mention that reactionrnn is also available as an R package with feature parity?
```
library(reactionrnn)
react <- reactionrnn()
react %>% predict("Happy Mother's Day from the Chicago Cubs!")
```
```
love wow haha sad angry
0.97649449 0.02350551 0.00000000 0.00000000 0.00000000
```
## Usage
For Python, reactionrnn can be installed [from pypi](https://pypi.python.org/pypi/reactionrnn) via `pip`:
```
python3 -m pip install reactionrnn
```
You may need to create a venv (`python3 -m venv <path>`) first.
For R, you can install reactionrnn from this GitHub repo with devtools (working on resolving issues to get package on CRAN):
```
# install.packages('devtools')
devtools::install_github("minimaxir/reactionrnn", subdir="R-package")
```
You can view a demo of common features in [this Jupyter Notebook](/docs/reactionrnn-demo-python.ipynb) for Python, and [this R Notebook](http://minimaxir.com/notebooks/reactionrnn/) for R. (full documentation coming soon)
## Neural Network Architecture and Implementation

reactionrnn is based off of the June 2016 blog post I wrote titled [Classifying the Emotions of Facebook Posts Using Reactions Data](http://minimaxir.com/2016/06/interactive-reactions/), which noted that there is a certain nuance to the proportionality of the reactions on a Facebook status. What makes a Facebook post "WOW" but *not* "HAHA"? Is there a semantic difference between a post with 75% SAD and 90% SAD? A year later, Facebook now has enough public data to sufficiently train a neural network to understand these nuances.
reactionrnn takes in an input of up to 140 characters (for compatability with Twitter tweets), converts each character to a 100D character embedding vector, and feeds those into a 256-cell [gated recurrent unit](https://en.wikipedia.org/wiki/Gated_recurrent_unit) layer. That output regresses the five non-Like Reactions all simultaneously and outputs the predicted proportionality values for each; predicted values will always sum to 1 (unlike Google's [Perspective API](https://www.perspectiveapi.com), the output is **not** the probability of the label as is the case with a classification model!)
The 1.3MB model weights included with the package are trained on the captions on hundreds of thousands of public Facebook statuses on Facebook PageExcerpt of 6,003 characters
Read on GitHubWould you bet a product on this? Bounded 0–100 and slow moving.
matched fp:7219775096c78a21, topic:deep-learning, topic:tensorflow
matched fp:7219775096c78a21, topic:sentiment-analysis, readme:sentiment analysis