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
Free Learning
Arrow right icon
Big Data Analytics with Java
Big Data Analytics with Java

Big Data Analytics with Java: Data analysis, visualization & machine learning techniques

eBook
$29.99 $43.99
Paperback
$54.99
Subscription
Free Trial
Renews at $19.99p/m

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

Big Data Analytics with Java

Chapter 2. First Steps in Data Analysis

Let's take the first steps towards data analysis now. Spark has a very useful module, Spark. Apache Spark has a prebuilt module called as Spark SQL and this module is used for structured data processing. Using this module, we can execute SQL queries on our underlying data. Spark lets you read data from various datasources whether text, CSV, or Parquet files on HDFS or also from hive tables or HBase tables. For simple data analysis tasks, whether you are exploring your datasets initially or trying to analyze and cut a report for your end users with simple stats this module is tremendously useful.

In this chapter, we will work on two datasets. The first dataset that we will analyze is a simple dataset and the next one is a more complex real-world dataset from an e-commerce store.

In this chapter, we will cover the following topics:

  • Basic statistical analytic approaches using Spark SQL
  • Building association rules using the Apriori algorithm...

Datasets

Before we get our hands wet in the world of complex analytics, we will take small baby steps and learn some basic statistical analysis first. This would help us get familiar with the approach that we will be using on big data for other solutions as well. For our analysis initially we will take a simple cars JSON dataset that has details about a few cars from different countries. We will analyze it using Spark SQL and see how easy it is to query and analyze datasets using Spark SQL. Spark SQL is handy to use for basic analytics purposes and is nicely suited on big data. It can be run on massive datasets and data can reside in HDFS.

To start with a simple case study we are using a cars dataset. This dataset can be obtained from http://www.carqueryapi.com/. It can be obtained from link http://www.carqueryapi.com/api/0.3/?callback=?&cmd=getMakes. This datasets contains data about cars in different countries. It is in JSON format. It is not a very big dataset from the perspective...

Data cleaning and munging

The major amount of time spent by a developer while performing a data analysis task is spent in data cleaning or producing data in a particular format. Most of the time, while performing analysis of some log file data or getting files from some other system, there will definitely be some data cleaning involved. Data cleaning can be in many forms whether it involves discarding a certain kind of data or converting some bad data into a different format. Also note that most of the machine learning algorithms involve running algorithms on a mathematical dataset, but most of the practical datasets won't always have mathematical data. Converting text data to mathematical form is another important task that many developers need to do themselves before they can apply the data analysis tasks on the data.

If there are problems in the data that we need to resolve before we use it, then this approach of fixing the data is called as data munging. One of the common data munging...

Basic analysis of data with Spark SQL

Spark SQL is a spark module for structured data processing. Almost all the developers know SQL. Spark SQL provides an SQL interface to your Spark data (RDDs). Using Spark SQL you can fire SQL queries or SQL-like queries on your big data set and fetch data in objects called dataframes.

A dataframe is like a relational database table. It has columns in it and we can apply functions to these columns such as groupBy, and so on. It is very easy to learn and use.

In the next section, we will cover a few examples on how we can use the dataframe and run regular analysis tasks.

Building SparkConf and context

This is just boilerplate code and is the entry point for the usage of our Spark SQL code. Every spark program will start with this boiler plate code for initialization. In this code we build the Spark configuration and then apply the configuration parameters (like application name and master location) and also build the SparkSession object. This SparkSession...

Implementation of the Apriori algorithm in Apache Spark

We have gone through the preceding algorithm. Now we will try to write the entire algorithm in Spark. Spark does not have a default implementation of Apriori algorithm, so we will have to write our own implementation as shown next (refer to the comments in the code as well).

First, we will have the regular boilerplate code to initiate the Spark configuration and context:

SparkConf conf = new SparkConf().setAppName(appName).setMaster(master);
JavaSparkContext sc = new JavaSparkContext(conf);

Now, we will load the dataset file using the SparkContext and store the result in a JavaRDD instance. We will create the instance of the AprioriUtil class. This class contains the methods for calculating the support and confidence values. Finally, we will store the total number of transactions (stored in the transactionCount variable) so that this variable can be broadcasted and reused on different DataNodes when needed:

JavaRDD<String> rddX ...

Summary

We started this chapter on a simple note by going over the very basic yet very power simple analytics on simple datasets. While doing so, we also learned a very powerful module of Apache Spark called Spark SQL. Using this module, Java developers can use their regular SQL skills and analyze their big data datasets.

After exploring the simple analytics piece using spark-sql, we went over two complex analytic algorithms: Apriori and FP-Growth. We learned how we can use these algorithms to build association rules from a transaction dataset.

In the next chapter, we will learn the basics of machine learning and get an introduction to the machine learning approach for dealing with a predictive analytics problem.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • • Acquire real-world set of tools for building enterprise level data science applications
  • • Surpasses the barrier of other languages in data science and learn create useful object-oriented codes
  • • Extensive use of Java compliant big data tools like apache spark, Hadoop, etc.

Description

This book covers case studies such as sentiment analysis on a tweet dataset, recommendations on a movielens dataset, customer segmentation on an ecommerce dataset, and graph analysis on actual flights dataset. This book is an end-to-end guide to implement analytics on big data with Java. Java is the de facto language for major big data environments, including Hadoop. This book will teach you how to perform analytics on big data with production-friendly Java. This book basically divided into two sections. The first part is an introduction that will help the readers get acquainted with big data environments, whereas the second part will contain a hardcore discussion on all the concepts in analytics on big data. It will take you from data analysis and data visualization to the core concepts and advantages of machine learning, real-life usage of regression and classification using Naïve Bayes, a deep discussion on the concepts of clustering,and a review of simple neural networks on big data using deepLearning4j or plain Java Spark code. This book is a must-have book for Java developers who want to start learning big data analytics and want to use it in the real world.

Who is this book for?

This book is for Java developers who are looking to perform data analysis in production environment. Those who wish to implement data analysis in their Big data applications will find this book helpful.

What you will learn

  • • Start from simple analytic tasks on big data
  • • Get into more complex tasks with predictive analytics on big data using
  • machine learning
  • • Learn real time analytic tasks
  • • Understand the concepts with examples and case studies
  • • Prepare and refine data for analysis
  • • Create charts in order to understand the data
  • • See various real-world datasets

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jul 31, 2017
Length: 418 pages
Edition : 1st
Language : English
ISBN-13 : 9781787288980
Vendor :
Apache
Category :
Languages :
Concepts :

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 : Jul 31, 2017
Length: 418 pages
Edition : 1st
Language : English
ISBN-13 : 9781787288980
Vendor :
Apache
Category :
Languages :
Concepts :

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 $5 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 $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 170.97
Java Data Analysis
$54.99
Big Data Analytics with Java
$54.99
Mastering Java Machine Learning
$60.99
Total $ 170.97 Stars icon
Banner background image

Table of Contents

14 Chapters
1. Big Data Analytics with Java Chevron down icon Chevron up icon
2. First Steps in Data Analysis Chevron down icon Chevron up icon
3. Data Visualization Chevron down icon Chevron up icon
4. Basics of Machine Learning Chevron down icon Chevron up icon
5. Regression on Big Data Chevron down icon Chevron up icon
6. Naive Bayes and Sentiment Analysis Chevron down icon Chevron up icon
7. Decision Trees Chevron down icon Chevron up icon
8. Ensembling on Big Data Chevron down icon Chevron up icon
9. Recommendation Systems Chevron down icon Chevron up icon
10. Clustering and Customer Segmentation on Big Data Chevron down icon Chevron up icon
11. Massive Graphs on Big Data Chevron down icon Chevron up icon
12. Real-Time Analytics on Big Data Chevron down icon Chevron up icon
13. Deep Learning Using Big Data Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3
(3 Ratings)
5 star 33.3%
4 star 66.7%
3 star 0%
2 star 0%
1 star 0%
Pach P Aug 25, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The best part about this book is that it covered the applicability of Big Data Analytics from multiple perspectives in very simple, easy to understand format. This allowed me to 'build a big picture view through hands on approach' on how to effectively leverage different Machine Learning concepts & APIs in Big Data Analytics.Each of the subjects was covered with clear and concise case studies and examples which I could readily take from github and tinker around. This was specially helpful and relevant to me as a relative newbie in this field who has tried making sense of it all by walking through the maze of blogs, api docs and videos.Were it basics on Big Data, Visualization, Regression, Sentiment Analytics or invaluable coverage on more advanced subjects like Graph Analytics, Recommendation Engines, Real Time Analytics and Deep Learning - easy readability and relatable examples helped me flow through the subjects and progressively build a deeper understanding of how these different ideas connect together.Hats off to the author for having taken the pains of cutting through the clutter and delivering the powerful concepts in elegantly simple examples. His efforts resulted in this deceptively simple yet comprehensive masterpiece which I could read and follow along from start to finish in about 6 weeks. Wish I had come across this book 2 years ago..
Amazon Verified review Amazon
Vladimir Alarcon Jan 09, 2020
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
**The Bad**80% of the code examples, JSON examples, and other don't pass the most basic syntax. Seriously. I don't know if the examples are intentionally badly written but they won't compile, not even close. The author talks about getting the code from some web site; maybe they work there, but don't expect to understand the example just by reading the book.The English writing skills are decent, though sometimes simple, if you know what I mean. I don't think it's OK to say "this is bad". The authors should phrase it better by saying something like "this won't work well in this scenario, or won't scale well in the future, and/or won't show the correct result all the time". Some personal opinions are phrased as facts without no further explanation... and some readers may think they are facts. Did I mention there are many misspellings?**The Good**The content. The book covers a fairly amount of content and buzzwords you have heard, and it explains it well, albeit sometimes in a too "simple" (read confusing) manner. It's fairly complete.A decent developer will be able to try each example 5 or 10 times to finally make it work, changing the syntax, guessing where to get the missing libraries, removing/adding some lines, figuring out imports, you-name-it. I found that this actually adds to the experience, so I ended up learning a lot with all that hands-on experimentation. However, an entry-level developer may not agree on this one.**Bottom Line**The book covers a lot of content you probably want to learn. It does explains those buzzwords pretty well. Finally, if you are a hands-on Java developer, you can squeeze knowledge from this book.
Amazon Verified review Amazon
alf_biker Nov 12, 2017
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
The book is good and covers a lot of stuff, but the code examples don't work. I think with a little more work it can be excellent.
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.