Coder Social home page Coder Social logo

zenjob's Introduction

Design

Technologies used: Grails

This is a poc for book recommendation service implemented purely using grails framework.

The core of the recommedation engine is BookRecommender interface along with UserBasedJdbcBookRecommender implementation.

There's a Mahout based recommender implementation which works but has been commented out to keep the dependencies simple.

User preferences : User's preference for a book (like/dislike) is represented by domain UserPreference. preference value of 1 represents like and -1 represents dislike.

UserBasedJdbcBookRecommender

It is a jdbc based recommender implementation which works by identifying neighbourhood of similar users based on the likes/dislikes.

Two user's are considered as similar if they have liked or disliked same books. Recommendations are made from the books liked by similar users but not yet rated by given user.

Weightage is assigned to each similar user based on the number of similar preferences (likes/dislikes). Books from a user with higher weightage will rank higher.

zenjob.recommender.proximityThreshold config can be used to specify how many preferences should match before a user is considered as similar user, default value is 3

Running tests

gradle check or grails test-app

Running app

gradle bootRun or grails run-app

Note: Sample books data is put inside data/books.txt which is imported on application startup.

Endpoints

App exposes following Rest endpoints

like/dislike a book

POST http://localhost:8080/books/$id/preferences

body

{"userId":2, "preference":1}
curl -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -i http://localhost:8080/books/1/preferences --data '{"userId":1, "preference":1}'

This endpoint creates a like/dislike for the book

Note: preference = 1 represents like, and preference = -1 represents dislike

User's preferences list

GET http://localhost:8080/users/$id/preferences

curl -X GET -H 'Accept: application/json' -i http://localhost:8080/users/1/preferences

This endpoint returns list of likes/dislikes for the user.

Recommendations

GET http://localhost:8080/users/$id/recommendations

curl -X GET -H 'Accept: application/json' -i http://localhost:8080/users/1/recommendations

This endpoint returns list of recommended books for the given user.

zenjob's People

Contributors

snimavat avatar

Watchers

James Cloos avatar

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.