For SPARK-5867: * The spark.ml programming guide needs to be updated to use the new SQL DataFrame API instead of the old SchemaRDD API. * It should also include Python examples now. For SPARK-5892: * Fix Python docs * Various other cleanups BTW, I accidentally merged this with master. If you want to compile it on your own, use this branch which is based on spark/branch-1.3 and cherry-picks the commits from this PR: [https://github.com/jkbradley/spark/tree/doc-review-1.3-check] CC: mengxr (ML), davies (Python docs) Author: Joseph K. Bradley <joseph@databricks.com> Closes #4675 from jkbradley/doc-review-1.3 and squashes the following commits: f191bb0 [Joseph K. Bradley] small cleanups e786efa [Joseph K. Bradley] small doc corrections 6b1ab4a [Joseph K. Bradley] fixed python lint test 946affa [Joseph K. Bradley] Added sample data for ml.MovieLensALS example. Changed spark.ml Java examples to use DataFrames API instead of sql() da81558 [Joseph K. Bradley] Merge remote-tracking branch 'upstream/master' into doc-review-1.3 629dbf5 [Joseph K. Bradley] Updated based on code review: * made new page for old migration guides * small fixes * moved inherit_doc in python b9df7c4 [Joseph K. Bradley] Small cleanups: toDF to toDF(), adding s for string interpolation 34b067f [Joseph K. Bradley] small doc correction da16aef [Joseph K. Bradley] Fixed python mllib docs 8cce91c [Joseph K. Bradley] GMM: removed old imports, added some doc 695f3f6 [Joseph K. Bradley] partly done trying to fix inherit_doc for class hierarchies in python docs a72c018 [Joseph K. Bradley] made ChiSqTestResult appear in python docs b05a80d [Joseph K. Bradley] organize imports. doc cleanups e572827 [Joseph K. Bradley] updated programming guide for ml and mllib
6.2 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 scalable machine learning library consisting of common learning algorithms and utilities, including classification, regression, clustering, collaborative filtering, dimensionality reduction, as well as underlying optimization primitives, as outlined below:
- Data types
- Basic statistics
- summary statistics
- correlations
- stratified sampling
- hypothesis testing
- random data generation
- Classification and regression
- linear models (SVMs, logistic regression, linear regression)
- naive Bayes
- decision trees
- ensembles of trees (Random Forests and Gradient-Boosted Trees)
- isotonic regression
- Collaborative filtering
- alternating least squares (ALS)
- Clustering
- Dimensionality reduction
- singular value decomposition (SVD)
- principal component analysis (PCA)
- Feature extraction and transformation
- Frequent pattern mining
- FP-growth
- Optimization (developer)
- stochastic gradient descent
- limited-memory BFGS (L-BFGS)
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.
spark.ml: high-level APIs for ML pipelines
Spark 1.2 introduced a new package called spark.ml
, which aims to provide a uniform set of
high-level APIs that help users create and tune practical machine learning pipelines.
It is currently an alpha component, and we would like to hear back from the community about
how it fits real-world use cases and how it could be improved.
Note that we will keep supporting and adding features to 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.mllib
and can optionally contribute
to spark.ml
.
See the spark.ml programming guide for more information on this package.
Dependencies
MLlib uses the linear algebra package Breeze, which depends on netlib-java for optimised numerical processing. If natives are not available at runtime, you will see a warning message and a pure JVM implementation will be used instead.
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).
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.
MLlib also uses jblas which will require you to install the gfortran runtime library if it is not already present on your nodes.
To use MLlib in Python, you will need NumPy version 1.4 or newer.
Migration Guide
For the spark.ml
package, please see the spark.ml Migration Guide.
From 1.2 to 1.3
In the spark.mllib
package, there were several breaking changes. The first change (in ALS
) is the only one in a component not marked as Alpha or Experimental.
- (Breaking change) In
ALS
, the extraneous methodsolveLeastSquares
has been removed. TheDeveloperApi
methodanalyzeBlocks
was also removed. - (Breaking change)
StandardScalerModel
remains an Alpha component. In it, thevariance
method has been replaced with thestd
method. To compute the column variance values returned by the originalvariance
method, simply square the standard deviation values returned bystd
. - (Breaking change)
StreamingLinearRegressionWithSGD
remains an Experimental component. In it, there were two changes:- The constructor taking arguments was removed in favor of a builder patten using the default constructor plus parameter setter methods.
- Variable
model
is no longer public.
- (Breaking change)
DecisionTree
remains an Experimental component. In it and its associated classes, there were several changes:- In
DecisionTree
, the deprecated class methodtrain
has been removed. (The object/statictrain
methods remain.) - In
Strategy
, thecheckpointDir
parameter has been removed. Checkpointing is still supported, but the checkpoint directory must be set before calling tree and tree ensemble training.
- In
PythonMLlibAPI
(the interface between Scala/Java and Python for MLlib) was a public API but is now private, declaredprivate[python]
. This was never meant for external use.
Previous Spark Versions
Earlier migration guides are archived on this page.