Inspiration

Bias in news is human. So we decided to use machine learning to discover it. What if you could click on a button in your browser and quickly determine the political bias of what you're reading?

What it does

Newstrality is an API and browser extension. The API is live at https://api.newstrality.org—send a POST request with a url field to that URL and you'll get detailed JSON in response.

{
  "ideology": -0.09590737375444658,
  "analysis": 26.767441860465116,
  "entities": [
    {
      "text": "Mr. Trump",
      "sentiment": {
        "score": -0.253766,
        "label": "negative"
      },
      "relevance": 0.920691
    },
    {
      "text": "elder Mr. Trump",
      "sentiment": {
        "score": 0.380982,
        "label": "positive"
      },
      "relevance": 0.677563
    },
    {
      "text": "Trump administration",
      "sentiment": {
        "score": -0.424259,
        "label": "negative"
      },
      "relevance": 0.665916
    },
    {
      "text": "Donald Trump Jr.",
      "sentiment": {
        "score": 0,
        "label": "neutral"
      },
      "relevance": 0.654288
    },
    {
      "text": "New York Times",
      "sentiment": {
        "score": 0.596504,
        "label": "positive"
      },
      "relevance": 0.648644
    },
    {
      "text": "Trump campaign",
      "sentiment": {
        "score": 0.873113,
        "label": "positive"
      },
      "relevance": 0.634824
    }
  ],
  "topics": [
    {
      "text": "George W. Bush",
      "relevance": 0.955089,
      "dbpedia_resource": "http://dbpedia.org/resource/George_W._Bush"
    },
    {
      "text": "Barack Obama",
      "relevance": 0.8615,
      "dbpedia_resource": "http://dbpedia.org/resource/Barack_Obama"
    },
    {
      "text": "Hillary Rodham Clinton",
      "relevance": 0.746399,
      "dbpedia_resource": "http://dbpedia.org/resource/Hillary_Rodham_Clinton"
    },
    {
      "text": "Bill Clinton",
      "relevance": 0.650885,
      "dbpedia_resource": "http://dbpedia.org/resource/Bill_Clinton"
    },
    {
      "text": "Donald Trump",
      "relevance": 0.632848,
      "dbpedia_resource": "http://dbpedia.org/resource/Donald_Trump"
    },
    {
      "text": "United States",
      "relevance": 0.632035,
      "dbpedia_resource": "http://dbpedia.org/resource/United_States"
    }
  ]
}

How we built it

We used Keras and scikit-learn to build our machine learning models on hundreds of thousands of news articles. While the machine learning team (Darcy and Alex) worked on perfecting their model, the rest of the team worked on making the data accessible and building out a web extension.

Challenges we ran into

While the model was very accurate from the beginning, we struggled in making the data user-meaningful; while it's tempting to simply throw numbers at the user, we ultimately used a spectrum-based color system instead.

Accomplishments that we're proud of

Our model has 97% accuracy when tested against training data. Plus, the user interface effectively makes sense of the data—and the JSON API is easy to use.

What we learned

What's next for Newstrality

We're going to deploy the web extension on the Chrome Web Store and Mozilla Marketplace!

Share this project:

Updates