r/MachineLearning • u/[deleted] • Sep 17 '22
Project [P] Made an NLP model that predicts subreddit based on the title of a post (link in comments)
8
Sep 17 '22
Cool project.
What kind of applications do you have in mind?
IMO, we could have a bot that suggests (as a comment) if a post should belong to a different subreddit.
Or you could build an app that posts automatically to recommended subreddits.
Another cool extension could be to predict how many upvotes it might get...or a better phrasing of the title (GPT3 could be used here).
3
2
Sep 17 '22
If anyone would like to work on one of the projects mentioned above, HuggingFace provides an API for the model that you can use :)
5
u/MTGTraner HD Hlynsson Sep 17 '22
4
1
4
4
u/nfsi0 Sep 17 '22
Awesome, can we use it to detect posts that don't fit the sub and point it out to the mods?
3
Sep 18 '22
Shouldn’t that be just built in into Reddit as a standard feature like type your headline and we will propose the best subreddit for your post?
2
3
u/nfsi0 Sep 18 '22
Wow that's a great idea, or even when you are posting it could suggest subs to crosspost too
1
4
u/Splatpope Sep 17 '22
are the titles in the images training or test data ?
3
Sep 17 '22
None actually
The train and test data contain top 1000 posts of all time.
And the posts in the images were simply trending on their respective subreddits yesterday when I was testing the model.
2
2
u/Prestigious_Dare7734 Sep 17 '22
You can post this on reddit beta as well, see if reddit notices as well. Or if some of subs moderators use this with their moderator bots to redirect a post to correct sub. And may be help with crossposting as well.
1
1
2
u/dingdongkiss Sep 17 '22
What did you use to make the web interface for running inference on the model? I've seen the same style UI in a couple projects
2
Sep 17 '22
I used the gradio library, really cool.
It integrates directly with Hugging Face Hub and Hugging Face Spaces.
2
2
2
u/maxmindev Sep 20 '22
This is incredible OP. Simple idea and great execution. I am interested in working on similar projects let me know if you want to collaborate
1
12
1
u/RageA333 Sep 17 '22
Did you train with 8 posts from each of the 125 subreddits (for a total of 1000)?
2
3
2
-2
u/bironsecret Sep 17 '22
what subreddits does it feature? from my tests, doesn't have any language subreddits or star wars memes
7
u/nmkd Sep 17 '22
Made an NLP model that predicts subreddit based on the title of a post
You'd know if you read OP's post.
the model was trained on top 125 subreddits
3
0
0
Sep 17 '22
[deleted]
12
u/nmkd Sep 17 '22
Read OP's post.
the model was trained on top 125 subreddits (for reference) therefore it can only categorise within those subreddits.



















51
u/[deleted] Sep 17 '22 edited Oct 01 '22
You can play with it on HuggingFace Space
I fine-tuned HuggingFace Transformers's DistilBERT on the dataset of titles of the top 1000 posts from the top 125 subreddits.
Notebooks for data collection and modeling are available on the GitHub repo. The Dataset and Model are hosted on HuggingFace.
Limitations and bias-
Because the model was trained on top 125 subreddits (for reference) therefore it can only categorise within those subreddits. I intend on increasing the count.
Some subreddits have a specific format for their post title, like r/todayilearned where post title starts with "TIL" so the model becomes biased towards "TIL" --> r/todayilearned. This can be removed by cleaning the dataset of these specific terms.
In some subreddit like r/gifs, the title of the post doesn't matter much, so the model struggles on them.
This was a fun project. I'd appreciate any ideas, feedback or suggestions for the project :)
EDIT: increased the sub count to 250