MLlib and Distributing the Singular Value Decomposition - Reza Zadeh

UN
Uni24h
0 lượt tải
42
0

Nội dung tài liệu

Trang 2

Outline Example Invocations Benefits of Iterations Singular Value Decomposition All-pairs Similarity Computation MLlib + {Streaming, GraphX, SQL} Future Directions

Trang 4

A General Platform Standard libraries included with Spark Spark MLlib Spark SQL Streaming" GraphX machine structured graph real-time learning … Spark Core

Trang 5

MLlib History MLlib is a Spark subproject providing machine learning primitives Initial contribution from AMPLab, UC Berkeley Shipped with Spark since Sept 2013

Trang 6

MLlib: Available algorithms classification: logistic regression, linear SVM," naïve Bayes, least squares, classification tree regression: generalized linear models (GLMs), regression tree collaborative filtering: alternating least squares (ALS), non-negative matrix factorization (NMF) clustering: k-means|| decomposition: SVD, PCA optimization: stochastic gradient descent, L-BFGS

Trang 12

Optimization At least two large classes of optimization problems humans can solve: - Convex Programs - Singular Value Decomposition

Trang 13

Optimization - LR data = spark.textFile(...).map(readPoint).cache() w = numpy.random.rand(D) for i in range(iterations): gradient = data.map(lambda p: (1 / (1 + exp(-­‐p.y * w.dot(p.x)))) * p.y * p.x ).reduce(lambda a, b: a + b) w -­‐= gradient print “Final w: %s” % w

Trang 14

MR PageRank Repeatedly multiply sparse matrix and vector Requires repeatedly hashing together page adjacency lists and rank vector Same file grouped over and over Neighbors (id, edges) Ranks (id, rank) … iteration 1 iteration 2 iteration 3

Trang 15

Spark PageRank Using cache(), keep neighbor lists in RAM Using partitioning, avoid repeated hashing partitionBy Neighbors (id, edges) Ranks (id, rank) … join join join

Trang 16

Spark PageRank Using cache(), keep neighbor lists in RAM Using partitioning, avoid repeated hashing partitionBy Neighbors (id, edges) same" node Ranks (id, rank) … join join join

Trang 17

Spark PageRank Using cache(), keep neighbor lists in RAM Using partitioning, avoid repeated hashing partitionBy Neighbors (id, edges) Ranks (id, rank) … join join join

Trang 18

PageRank Code # RDD of (id, neighbors) pairs links = spark.textFile(...).map(parsePage) .partitionBy(128).cache() ranks = links.mapValues(lambda v: 1.0) # RDD of (id, rank) for i in range(ITERATIONS): ranks = links.join(ranks).flatMap( lambda (id, (links, rank)): [(d, rank/links.size) for d in links] ).reduceByKey(lambda a, b: a + b) Generalizes to Matrix Multiplication, opening many algorithms from Numerical Linear Algebra

Trang 19

PageRank Results 200 171 Hadoop 150 Basic Spark 100 72 Spark + Controlled Time per iteration (s)50 23 Partitioning 0

Hiển thị 19 trang đầu. Tải tài liệu để xem đầy đủ.

Bình luận (0)

Đăng nhập để tham gia bình luận

Chưa có bình luận nào. Hãy là người đầu tiên!