3
$\begingroup$

So I have a large collection of blog posts containing title, content, category, tags and geo-location fields and I'm looking to achieve three things:

  1. Assign a category (or multiple categories) to all the posts and any new ones. I have a strict vocabulary of categories.
  2. Add new tags to the posts that might be relevant to the post.
  3. Mark the post if it contains information about a place. For example: Lorem ipsum dolor sit amet San Francisco, consectetur adipiscing elit.

I've been looking into different machine learning algorithms, most recently decision trees, but I don't feel that is the best algorithm to work out the problems above (or that I haven't understood them enough).

Many of these posts already contain categories, tags and geo-location data. Some do not contain any information and some have only a few details.

What would be the best machine learning algorithm to look into to solve each of the three areas?

$\endgroup$
  • $\begingroup$ Out of curiosity and as it is related to the answers which might make sense: What is a "large collection of blog posts" in your case? Several hundreds of posts? Thousands? $\endgroup$ – Martin Thoma Jan 4 '16 at 12:12
  • $\begingroup$ About 80,000 posts. $\endgroup$ – user2075215 Jan 4 '16 at 12:49
  • $\begingroup$ Out of curiosity: Are all of the blog posts written in the same language? And how accurate should the geo-location be? Country? Area (e.g. "West Coast United States")? City? $\endgroup$ – knb Jan 4 '16 at 12:55
  • $\begingroup$ There a two languages, English and Spanish and place names will be US mostly, if it fails to pick cities outside of the US then that isn't a massive problem. In the answer below it talks about doing a basic search which is great, but I'm interested in playing around with machine learning and I'm looking for an algorithm to learn more about it, especially dealing with false positives such as John Denver (bad example maybe) but I don't to mark that post with Denver, Colorado. $\endgroup$ – user2075215 Jan 4 '16 at 13:06
2
$\begingroup$

Question 1: Category prediction

To predict the category of a new blog post, you could do the following:

  • Build a MLP (multilayer Perceptron, a very simple neural network). Each category gets an output node, each tag is a binary input node. However, this will only work if the number of tags is very little. As soon as you add new tags, you will have to retrain the network.
  • Build a MLP with "important words" as features.
  • If you have internal links, you might want to have a look at "On Node Classification in Dynamic Content-based Networks". In case you're German, you might also like Über die Klassifizierung von Knoten in dynamischen Netzwerken mit Inhalt
  • You could take all words you currently have, see those as a vector space. Fix that vocabulary (and probably remove some meaningless words like "with", "a", "an" - this is commonly called a "stopword"). For each text, you count the different words you have in your vocabulary. A new blog post is point in this space. Use $k$ nearest neighbor for classification.
  • Use combinations of different predictiors by letting each predictor give a vote for a classification.

See also

Question 2: Tagging texts

This can be treated the same way like question 1.

Question 3: Finding locations

Download a database of countries / cities (e.g. maxmind) and just search for a match.

$\endgroup$
  • $\begingroup$ Thank you for your answer, the location solution would work great, but what about (as mentioned above) false positives such as John Denver (bad example maybe) but I don't to mark that post with Denver, Colorado - I guess looking at using Stanford NLP might be a solution. But out of interest any other ways to go about this will be of interest. $\endgroup$ – user2075215 Jan 4 '16 at 13:08
1
$\begingroup$

For text data, linear SVMs are still state of the art.

For named entity recognition, look up some NER toolkits.

$\endgroup$
1
$\begingroup$

You might want to look at Naive Bayes classifier or have a look at this page on Very simple text classification by machine learning. You could also look at Stanford Named Entity Tagger.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.