spark-instrumented-optimizer/docs/mllib-guide.md
Timothy Hunter 2ecbe02d5b [SPARK-12212][ML][DOC] Clarifies the difference between spark.ml, spark.mllib and mllib in the documentation.
Replaces a number of occurences of `MLlib` in the documentation that were meant to refer to the `spark.mllib` package instead. It should clarify for new users the difference between `spark.mllib` (the package) and MLlib (the umbrella project for ML in spark).

It also removes some files that I forgot to delete with #10207

Author: Timothy Hunter <timhunter@databricks.com>

Closes #10234 from thunterdb/12212.
2015-12-10 12:50:46 -08:00

6.7 KiB

layout title displayTitle description
global MLlib Machine Learning Library (MLlib) Guide MLlib machine learning library overview for Spark SPARK_VERSION_SHORT

MLlib is Spark's machine learning (ML) library. Its goal is to make practical machine learning scalable and easy. It consists of common learning algorithms and utilities, including classification, regression, clustering, collaborative filtering, dimensionality reduction, as well as lower-level optimization primitives and higher-level pipeline APIs.

It divides into two packages:

Using spark.ml is recommended because with DataFrames the API is more versatile and flexible. But we will keep supporting spark.mllib along with the development of spark.ml. Users should be comfortable using spark.mllib features and expect more features coming. Developers should contribute new algorithms to spark.ml if they fit the ML pipeline concept well, e.g., feature extractors and transformers.

We list major functionality from both below, with links to detailed guides.

spark.mllib: data types, algorithms, and utilities

spark.ml: high-level APIs for ML pipelines

Some techniques are not available yet in spark.ml, most notably dimensionality reduction Users can seemlessly combine the implementation of these techniques found in spark.mllib with the rest of the algorithms found in spark.ml.

Dependencies

MLlib uses the linear algebra package Breeze, which depends on netlib-java for optimised numerical processing. If natives libraries1 are not available at runtime, you will see a warning message and a pure JVM implementation will be used instead.

Due to licensing issues with runtime proprietary binaries, we do not include netlib-java's native proxies by default. To configure netlib-java / Breeze to use system optimised binaries, include com.github.fommil.netlib:all:1.1.2 (or build Spark with -Pnetlib-lgpl) as a dependency of your project and read the netlib-java documentation for your platform's additional installation instructions.

To use MLlib in Python, you will need NumPy version 1.4 or newer.

Migration guide

MLlib is under active development. The APIs marked Experimental/DeveloperApi may change in future releases, and the migration guide below will explain all changes between releases.

From 1.4 to 1.5

In the spark.mllib package, there are no break API changes but several behavior changes:

  • SPARK-9005: RegressionMetrics.explainedVariance returns the average regression sum of squares.
  • SPARK-8600: NaiveBayesModel.labels become sorted.
  • SPARK-3382: GradientDescent has a default convergence tolerance 1e-3, and hence iterations might end earlier than 1.4.

In the spark.ml package, there exists one break API change and one behavior change:

  • SPARK-9268: Java's varargs support is removed from Params.setDefault due to a Scala compiler bug.
  • SPARK-10097: Evaluator.isLargerBetter is added to indicate metric ordering. Metrics like RMSE no longer flip signs as in 1.4.

Previous Spark versions

Earlier migration guides are archived on this page.



  1. To learn more about the benefits and background of system optimised natives, you may wish to watch Sam Halliday's ScalaX talk on High Performance Linear Algebra in Scala. ↩︎