The Virtual Library, an R Shiny Application

[This article was first published on R – NYC Data Science Academy Blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The Objective

Organizing books by genre falls far short of telling a perspective reader if that book is of any interest to them.  Any one book can fall into dozens of categories while two books in the same category share almost nothing in common.  This makes identifying a good read extremely difficult, so authors add book descriptions.  Book descriptions can be helpful but without knowing anything about the author it can be hard to know if the book fits other criteria you may be interested in.  This Shiny app aims to solve that problem.  It provides readers with a database of over fifty thousand books.  Simply select your favorite and a suggestion will be provided.  Peruse authors, compare genres and most importantly, easily identify your next read.  Click here to view the app: Virtual Library 

Book Recommender

When the application is opened the user is given the opportunity to input a book.  The book recommendation system then suggests a book most similar to the selected book.  The recommendation system works using Doc2Vec on the book descriptions.  The book title, cover, description, author and genre are all included.

Author Investigation

So, you have input your favorite book and the book recommender returned a book by an author you have never heard of.  Maybe you just want to know more about an author you already love.  The author section of this application allows you to investigate authors one at a time.  The top of the page provides an average rating, average number of pages and the highest rated book.  Let’s investigate my personal favorite author, Patrick Rothfuss. 

Clearly Patrick Rothfuss writes long books and they are well received.  The page also includes two graphs.  The first is a scatter plot of every book written by that author.  The x-axis is the rating of that book and the y-axis is the number of pages.  Hovering over a book will show you the book title. 

Here, you can see that almost all of his books are above 500 pages and get high ratings.  The second graph is a bar graph showing the performance of that author in each genre.  

Unsurprisingly Patricks highest rated genres are Adult, Epic and Adventure.  Those are the top genres of The King Killer Chronicals, the series he is best known for.  

Genre Analysis

In this section of the application the user has the ability to compare genres by page count, average rating and rating by page count.  Two genres are selected and three graphs are output.  These graphs can be manipulated based on a selected page range.  Continuing our investigating, we decide that Patricks books are too long for our current interests but that we like his writing style and want to stay in his top genres.  Lets compare Epic Fantasy and Adventure.  

This density plot shows the distribution of page counts within a genre.  Here it is clear that the Adventure category has shorter books, generally.  We can then look at the box plot to compare avergare rating of different genres.  Here it is clear that the two genres aren’t very different but Epic Fantasy receives higher reviews.

Finally, we can look at the ratings of each genre by bucketing the books into their respective page counts.

We are looking for a shorter book, so we can potentially look into Adventure books or Epic Fantasys in the lower range because they receive fairly good ratings on average.

Future work

In the future I would like to collect more book samples.  If more resources were available I would like to train the description vectorization model on the entire book text instead of the descriptions of the books.

My Github

My LinkedIn

To leave a comment for the author, please follow the link and comment on their blog: R – NYC Data Science Academy Blog.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)