Book description
Navigate the world of data analysis, visualization, and machine learning with over 100 hands-on Scala recipes
About This Book
- Implement Scala in your data analysis using features from Spark, Breeze, and Zeppelin
- Scale up your data anlytics infrastructure with practical recipes for Scala machine learning
- Recipes for every stage of the data analysis process, from reading and collecting data to distributed analytics
Who This Book Is For
This book shows data scientists and analysts how to leverage their existing knowledge of Scala for quality and scalable data analysis.
What You Will Learn
- Familiarize and set up the Breeze and Spark libraries and use data structures
- Import data from a host of possible sources and create dataframes from CSV
- Clean, validate and transform data using Scala to pre-process numerical and string data
- Integrate quintessential machine learning algorithms using Scala stack
- Bundle and scale up Spark jobs by deploying them into a variety of cluster managers
- Run streaming and graph analytics in Spark to visualize data, enabling exploratory analysis
In Detail
This book will introduce you to the most popular Scala tools, libraries, and frameworks through practical recipes around loading, manipulating, and preparing your data. It will also help you explore and make sense of your data using stunning and insightfulvisualizations, and machine learning toolkits.
Starting with introductory recipes on utilizing the Breeze and Spark libraries, get to grips withhow to import data from a host of possible sources and how to pre-process numerical, string, and date data. Next, you'll get an understanding of concepts that will help you visualize data using the Apache Zeppelin and Bokeh bindings in Scala, enabling exploratory data analysis. iscover how to program quintessential machine learning algorithms using Spark ML library. Work through steps to scale your machine learning models and deploy them into a standalone cluster, EC2, YARN, and Mesos. Finally dip into the powerful options presented by Spark Streaming, and machine learning for streaming data, as well as utilizing Spark GraphX.
Style and approach
This book contains a rich set of recipes that covers the full spectrum of interesting data analysis tasks and will help you revolutionize your data analysis skills using Scala and Spark.
Table of contents
-
Scala Data Analysis Cookbook
- Table of Contents
- Scala Data Analysis Cookbook
- Credits
- About the Author
- About the Reviewers
- www.PacktPub.com
- Preface
-
1. Getting Started with Breeze
- Introduction
- Getting Breeze – the linear algebra library
-
Working with vectors
- Getting ready
-
How to do it...
- Creating vectors
- Constructing a vector from values
- Creating a vector out of a function
- Creating a vector of linearly spaced values
- Creating a vector with values in a specific range
- Creating an entire vector with a single value
- Slicing a sub-vector from a bigger vector
- Creating a Breeze Vector from a Scala Vector
- Vector arithmetic
- Scalar operations
- Calculating the dot product of two vectors
- Creating a new vector by adding two vectors together
- Appending vectors and converting a vector of one type to another
- Concatenating two vectors
- Standard deviation
- Find the largest value in a vector
- Finding the sum, square root and log of all the values in the vector
- Working with matrices
-
Vectors and matrices with randomly distributed values
-
How it works...
- Creating vectors with uniformly distributed random values
- Creating vectors with normally distributed random values
- Creating vectors with random values that have a Poisson distribution
- Creating a matrix with uniformly random values
- Creating a matrix with normally distributed random values
- Creating a matrix with random values that has a Poisson distribution
-
How it works...
- Reading and writing CSV files
-
2. Getting Started with Apache Spark DataFrames
- Introduction
- Getting Apache Spark
- Creating a DataFrame from CSV
- Manipulating DataFrames
- Creating a DataFrame from Scala case classes
- 3. Loading and Preparing Data – DataFrame
- 4. Data Visualization
-
5. Learning from Data
- Introduction
- Supervised and unsupervised learning
- Gradient descent
- Predicting continuous values using linear regression
- Binary classification using LogisticRegression and SVM
-
Binary classification using LogisticRegression with Pipeline API
-
How to do it...
- Importing and splitting data as test and training sets
- Construct the participants of the Pipeline
- Preparing a pipeline and training a model
- Predicting against test data
- Evaluating a model without cross-validation
- Constructing parameters for cross-validation
- Constructing cross-validator and fit the best model
- Evaluating the model with cross-validation
-
How to do it...
- Clustering using K-means
-
Feature reduction using principal component analysis
-
How to do it...
- Dimensionality reduction of data for supervised learning
- Mean-normalizing the training data
- Extracting the principal components
- Preparing the labeled data
- Preparing the test data
- Classify and evaluate the metrics
- Dimensionality reduction of data for unsupervised learning
- Mean-normalizing the training data
- Extracting the principal components
- Arriving at the number of components
- Evaluating the metrics
-
How to do it...
- 6. Scaling Up
- 7. Going Further
- Index
Product information
- Title: Scala Data Analysis Cookbook
- Author(s):
- Release date: October 2015
- Publisher(s): Packt Publishing
- ISBN: 9781784396749
You might also like
book
Scala Machine Learning Projects
Powerful smart applications using deep learning algorithms to dominate numerical computing, deep learning, and functional programming. …
book
Scala and Spark for Big Data Analytics
Harness the power of Scala to program Spark and analyze tonnes of data in the blink …
book
Scala: Guide for Data Science Professionals
Scala will be a valuable tool to have on hand during your data science journey for …
book
Scala:Applied Machine Learning
Leverage the power of Scala and master the art of building, improving, and validating scalable machine …