Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
R Data Analysis Projects
R Data Analysis Projects

R Data Analysis Projects: Build end to end analytics systems to get deeper insights from your data

Arrow left icon
Profile Icon Gopi Subramanian
Arrow right icon
Free Trial
Full star icon Full star icon Full star icon Full star icon Full star icon 5 (2 Ratings)
Paperback Nov 2017 366 pages 1st Edition
eBook
NZ$14.99 NZ$64.99
Paperback
NZ$80.99
Subscription
Free Trial
Arrow left icon
Profile Icon Gopi Subramanian
Arrow right icon
Free Trial
Full star icon Full star icon Full star icon Full star icon Full star icon 5 (2 Ratings)
Paperback Nov 2017 366 pages 1st Edition
eBook
NZ$14.99 NZ$64.99
Paperback
NZ$80.99
Subscription
Free Trial
eBook
NZ$14.99 NZ$64.99
Paperback
NZ$80.99
Subscription
Free Trial

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

R Data Analysis Projects

Fuzzy Logic Induced Content-Based Recommendation

When a friend comes to you for a movie recommendation, you don't arbitrarily start shooting movie names. You try to suggest movies while keeping in mind your friend's tastes. Content-based recommendation systems try to mimic the exact same process. Consider a scenario in which a user is browsing through a list of products. Given a set of products and the associated product properties, when a person views a particular product, content-based recommendation systems can generate a subset of products with similar properties to the one currently being viewed by the user. Typical content-based recommendation systems tend to also include the user profile. In this chapter, however, we will not be including the user profiles. We will be working solely with the item/product profiles. Content-based recommendation systems are also...

Introducing content-based recommendation

To understand the inner workings of a content-based recommendation system, let's look at a simple example. We will use the wine dataset from https://archive.ics.uci.edu/ml/datasets/wine

This dataset is the result of the chemical analysis of wine grown in the same region in Italy. We have data from three different cultivars (From an assemblage of plants selected for desirable characters, Wikipedia: https://en.wikipedia.org/wiki/Cultivar).

Let's extract the data from UCI machine learning repository:

> library(data.table)
> wine.data <- fread('https://archive.ics.uci.edu/ml/machine-learning-databases/wine/wine.data')
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0...

News aggregator use case and data

We have 1,000 news articles from different publishers. Each article belongs to a different category: technical, entertainment, and others. Our case is to alleviate the cold start problem faced by our customers. Simply put, what do we recommend to a customer when we don't have any information about his preferences? We are either looking at the customer for the first time or we don't have any mechanism set up yet to capture customer interaction with our products/items.

This data is a subset of the news aggregator dataset from https://archive.ics.uci.edu/ml/datasets/News+Aggregator.

A subset of the data is stored in a csv file.

Let's quickly look at the data provided:

> library(tidyverse)
> library(tidytext)
> library(tm)
> library(slam)
>
>
> cnames <- c('ID' , 'TITLE' , 'URL' ,
+...

Designing the content-based recommendation engine

To rewrite our customer requirements in plain English: When a customer browses a particular article, what other articles should we suggest to him?

Let's quickly recap how a content-based recommendation engine works. When a user is browsing a product or item, we need to provide recommendations to the user in the form of other products or items from our catalog. We can use the properties of the items to come up with the recommendations. Let's translate this to our use case.

Items in our case, are news articles.

The properties of a news article are as follows:

  • Its content, stored in a text column
  • The publisher--who published the article
  • The category to which the article belongs

So when a user is browsing a particular news article, we need to give him other news articles as recommendations, based on:

  • The text content...

Complete R Code

The complete R code is shown as follows:

library(data.table)

wine.data <- fread('https://archive.ics.uci.edu/ml/machine-learning-databases/wine/wine.data')
head(wine.data)

table(wine.data$V1)

wine.type <- wine.data[,1]
wine.features <- wine.data[,-1]

wine.features.scaled <- data.frame(scale(wine.features))
wine.mat <- data.matrix(wine.features.scaled)

rownames(wine.mat) <- seq(1:dim(wine.features.scaled)[1])
wine.mat[1:2,]

wine.mat <- t(wine.mat)
cor.matrix <- cor(wine.mat, use = "pairwise.complete.obs", method = "Pearson")
dim(cor.matrix)
cor.matrix[1:5,1:5]

user.view <- wine.features.scaled[3,]
user.view

sim.items <- cor.matrix[3,]
sim.items
sim.items.sorted <- sort(sim.items, decreasing = TRUE)
sim.items.sorted[1:5]

rbind(wine.data[3,]
,wine.data[52,]
,wine.data[51,]
,wine.data[85,]
,wine.data[15,]
)








library(tidyverse)
library...

Summary

We started the chapter by introducing content-based filtering. We discussed how content based filtering methods can help with cold-start problems in recommendation systems. We then explained the new aggregator use case. We explored the data provided by the customer--various news articles from different publishers belonging to different categories. Based on the data, we came up with a design for our content-based recommendation system.

We implemented a similarity dictionary; given a news article, this dictionary would be able to provide the top N matching articles. The similarity was calculated based on the words present in the article. We leveraged the vector space model for text and ultimately used the cosine distance to find the similarities between articles.

We implemented a simple search based on the similarity dictionary to get a list of matching news articles. We...

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • • A handy guide to take your understanding of data analysis with R to the next level
  • • Real-world projects that focus on problems in finance, network analysis, social media, and more
  • • From data manipulation to analysis to visualization in R, this book will teach you everything you need to know about building end-to-end data analysis pipelines using R

Description

R offers a large variety of packages and libraries for fast and accurate data analysis and visualization. As a result, it’s one of the most popularly used languages by data scientists and analysts, or anyone who wants to perform data analysis. This book will demonstrate how you can put to use your existing knowledge of data analysis in R to build highly efficient, end-to-end data analysis pipelines without any hassle. You’ll start by building a content-based recommendation system, followed by building a project on sentiment analysis with tweets. You’ll implement time-series modeling for anomaly detection, and understand cluster analysis of streaming data. You’ll work through projects on performing efficient market data research, building recommendation systems, and analyzing networks accurately, all provided with easy to follow codes. With the help of these real-world projects, you’ll get a better understanding of the challenges faced when building data analysis pipelines, and see how you can overcome them without compromising on the efficiency or accuracy of your systems. The book covers some popularly used R packages such as dplyr, ggplot2, RShiny, and others, and includes tips on using them effectively. By the end of this book, you’ll have a better understanding of data analysis with R, and be able to put your knowledge to practical use without any hassle.

Who is this book for?

If you are looking for a book that takes you all the way through the practical application of advanced and effective analytics methodologies in R, then this is the book for you. A fundamental understanding of R and the basic concepts of data analysis is all you need to get started with this book.

What you will learn

  • • Build end-to-end predictive analytics systems in R
  • • Build an experimental design to gather your own data and conduct analysis
  • • Build a recommender system from scratch using different approaches
  • • Use and leverage RShiny to build reactive programming applications
  • • Build systems for varied domains including market research, network analysis, social media analysis, and more
  • • Explore various R Packages such as RShiny, ggplot, recommenderlab, dplyr, and find out how to use them effectively
  • • Communicate modeling results using Shiny Dashboards
  • • Perform multi-variate time-series analysis prediction, supplemented with sensitivity analysis and risk modeling

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Nov 17, 2017
Length: 366 pages
Edition : 1st
Language : English
ISBN-13 : 9781788621878
Category :
Languages :
Concepts :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Nov 17, 2017
Length: 366 pages
Edition : 1st
Language : English
ISBN-13 : 9781788621878
Category :
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just NZ$7 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just NZ$7 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total NZ$ 233.97
R Data Analysis Projects
NZ$80.99
R Data Mining
NZ$71.99
R Data Analysis Cookbook, Second Edition
NZ$80.99
Total NZ$ 233.97 Stars icon
Banner background image

Table of Contents

8 Chapters
Association Rule Mining Chevron down icon Chevron up icon
Fuzzy Logic Induced Content-Based Recommendation Chevron down icon Chevron up icon
Collaborative Filtering Chevron down icon Chevron up icon
Taming Time Series Data Using Deep Neural Networks Chevron down icon Chevron up icon
Twitter Text Sentiment Classification Using Kernel Density Estimates Chevron down icon Chevron up icon
Record Linkage - Stochastic and Machine Learning Approaches Chevron down icon Chevron up icon
Streaming Data Clustering Analysis in R Chevron down icon Chevron up icon
Analyze and Understand Networks Using R Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Full star icon 5
(2 Ratings)
5 star 100%
4 star 0%
3 star 0%
2 star 0%
1 star 0%
Amazon Customer Jul 26, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Good
Amazon Verified review Amazon
Anand Nov 12, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Good book covering projects with background and complete codes in shiny. However for the background stuff about algorithms you need to refer other sources, which-acceptably- cannot be included in a single book. Variety of tasks allow you to pick a chapter individually but a sequential reading is also useful since some topics are inter related. Good for those whio have understanding of R and Shiny.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.