O'Reilly logo

Learning Apache Mahout by Chandramani Tiwary

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

In-core types

Vector and Matrices are of type in-core or in-memory. We will try out some basic commands to get a feel of the linear algebra operations possible.

Vector

We will first discuss vectors and then cover matrices. We will see some examples of operations that can be performed on vectors.

Initializing a vector inline

Dense vector: The dense vector is a vector with relatively fewer zero elements. On the Mahout command line, please type the following command to initialize a dense vector:

mahout>val denseVec1: Vector = (1.0, 1.1, 1.2)

Each element is prefixed by its index, which starts with 0. The output of the command executed is given as follows:

denseVec1: org.apache.mahout.math.Vector = {0:1.0,1:1.1,2:1.2}

Sparse vector: Sparse vector is ...

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