O'Reilly logo

Machine Learning with Spark - Second Edition by Nick Pentreath, Manpreet Singh Ghotra, Rajdeep Dua

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Functions

To define a mathematical object like a function, we must first understand what a set is.

A set is an unordered collection of objects like S = {-4, 4, -3, 3, -2, 2, -1, 1, 0}. If a set S is not infinite, we use |S| to denote the number of elements, which is known as the Cardinality of the set. If A and B are finite sets, then |A⇥B|=|A|⇥|B|, which is known as the Cartesian product.

For each input element in a set A, a function assigns a single output element from another set B. A is called the domain of the function, and B, the codomain. A function is a set of pairs (x, y), with none of these pairs having the same first element.

Example: The function with domain {1, 2, 3, . . .}, which doubles its input is the set {(1,2),(2,4),(3,6),(4,8),...} ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required