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

Functional composition

For functions f: A -> B and g: B -> C, the functional composition of function f and function g is the function (g o f): A -> C, defined by (g o f)(x) = g(f(x)). For example, if f : {1,2,3} -> {A,B,C,D} and g : {A,B,C,D} -> {4,5}, the composition of g(y)=y2 and f(x)=x+1 is (g o f)(x)=(x+1)2.

Function composition is applying a function to the results of another function. So, in (g o f)(x) = g(f(x)), first apply f(), and then g(). Some functions can be decomposed into two (or more) simpler functions.

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