Book Image

Hands-On Data Analysis with Scala

By : Rajesh Gupta
Book Image

Hands-On Data Analysis with Scala

By: Rajesh Gupta

Overview of this book

Efficient business decisions with an accurate sense of business data helps in delivering better performance across products and services. This book helps you to leverage the popular Scala libraries and tools for performing core data analysis tasks with ease. The book begins with a quick overview of the building blocks of a standard data analysis process. You will learn to perform basic tasks like Extraction, Staging, Validation, Cleaning, and Shaping of datasets. You will later deep dive into the data exploration and visualization areas of the data analysis life cycle. You will make use of popular Scala libraries like Saddle, Breeze, Vegas, and PredictionIO for processing your datasets. You will learn statistical methods for deriving meaningful insights from data. You will also learn to create applications for Apache Spark 2.x on complex data analysis, in real-time. You will discover traditional machine learning techniques for doing data analysis. Furthermore, you will also be introduced to neural networks and deep learning from a data analysis standpoint. By the end of this book, you will be capable of handling large sets of structured and unstructured data, perform exploratory analysis, and building efficient Scala applications for discovering and delivering insights
Table of Contents (14 chapters)
Free Chapter
Section 1: Scala and Data Analysis Life Cycle
Section 2: Advanced Data Analysis and Machine Learning
Section 3: Real-Time Data Analysis and Scalability

k-means cluster analysis

k-means is a clustering ML algorithm. This is a nonsupervised ML algorithm. Its primary use is for clustering together closely related data and gaining an understanding of the structural properties of the data.

As the name suggests, this algorithm tries to form a k number of clusters around k-mean values. How many clusters are to be formed, that is, the value of k, is something a human being has to determine at the outset. This algorithm relies on the Euclidean distance to calculate the distance between two points. We can think of each observation as a point in n-dimensional space, where n is the number of features. The distance between two observations is the Euclidean distance between these in n-dimensional space.

To begin with, the algorithm picks up k random records from the dataset. These are the initial k-mean values. In the next step, for each record...