Book Image

Machine Learning with Scala Quick Start Guide

By : Md. Rezaul Karim, Ajay Kumar N
Book Image

Machine Learning with Scala Quick Start Guide

By: Md. Rezaul Karim, Ajay Kumar N

Overview of this book

Scala is a highly scalable integration of object-oriented nature and functional programming concepts that make it easy to build scalable and complex big data applications. This book is a handy guide for machine learning developers and data scientists who want to develop and train effective machine learning models in Scala. The book starts with an introduction to machine learning, while covering deep learning and machine learning basics. It then explains how to use Scala-based ML libraries to solve classification and regression problems using linear regression, generalized linear regression, logistic regression, support vector machine, and Naïve Bayes algorithms. It also covers tree-based ensemble techniques for solving both classification and regression problems. Moving ahead, it covers unsupervised learning techniques, such as dimensionality reduction, clustering, and recommender systems. Finally, it provides a brief overview of deep learning using a real-life example in Scala.
Table of Contents (9 chapters)

NB for churn prediction

The NB classifier is based on Bayes' theorem, with the following assumptions:

  • Independence between every pair of features
  • Feature values are non-negative, such as counts

For example, if cancer is related to age, this can be used to assess the probability that a patient might have cancer. Bayes' theorem is stated mathematically as follows:

In the preceding equation, A and B are events with P (B) ≠ 0. The other terms can be described as follows:

  • P (A | B) is called the posterior or the conditional probability of observing event A, given that B is true
  • P (B| A) is the likelihood of event B given that A is true
  • P(A) is the prior and P(B) is the prior probability, also called marginal likelihood or marginal probability

Gaussian NB is a generalized version of NB that's used for classification, which is based on the binomial distribution...