GithubHelp home page GithubHelp logo

hn-ranker's Introduction

Abstract

The goal of this project was to predict the scores of Hacker News articles. To do this, I tried training a feedforward ANN on two week's worth of Hacker News posts. During preprocessing, articles were decomposed into a list of keyword frequencies which was then fed to the network.

Results

Brief summary: the results were not very impressive. The ANN learned to classify the documents it was trained on, but it did not generalize well to other articles (i.e. it overfit the data).

Data set Total 0-1 2-4 5-9 10-49 50+
Training 8866/10194 4294/4618 3455/3810 413/675 269/485 435/606
Cross 2007/4368 1126/1980 838/1633 14/269 11/230 18/256

Usage

First things first, install Go and setup a GOPATH. Next, download this code as follows:

$ go get github.com/unixpickle/hn-ranker

Now, change to the source directory so you can run the code:

$ cd $GOPATH/src/github.com/unixpickle/hn-ranker

In order to get a working classifier, you must go through several steps. First, fetch metadata about a large number of stories:

$ go run *.go stories ./story_metadata.json
2016/05/18 16:45:56 Fetching... (press ctrl+C to finish).
2016/05/18 16:46:01 Gotten story from 72 hours ago (1 stories)
2016/05/18 16:46:01 Gotten story from 72 hours ago (2 stories)
2016/05/18 16:46:01 Gotten story from 72 hours ago (3 stories)
2016/05/18 16:46:02 Gotten story from 72 hours ago (4 stories)
...

The above command fetches story metadata and will save it in story_metadata.json once you terminate the program with Control+C or once an error is encountered.

Next, you must fetch the actual contents of every story. This involves scraping many linked URLs (one per story). You can do this as follows:

$ go run *.go scrape ./story_metadata.json story_contents/

This will create a story_contents directory with a list of .txt files. While scraping, the scrape sub-command may log many errors to the console. While the scrape sub-command does log any errors it encounters, it continues fetching stories in spite of these errors. This prevents stories with broken links from holding up the entire data mining process.

TODO: document how to train some kind of classifier with the mined data. In order to add this, I will first have to figure out how it will work.

hn-ranker's People

Contributors

unixpickle avatar

Watchers

 avatar

Forkers

5l1v3r1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.