for complex analy cal queries
play

for Complex Analy;cal Queries Milos Nikolic, Mohammed El - PowerPoint PPT Presentation

LINVIEW: Incremental View Maintenance for Complex Analy;cal Queries Milos Nikolic, Mohammed El Seidy, Christoph Koch DATA, EPFL SIGMOD,


  1. ¡ ¡ ¡ ¡ ¡ ¡ ¡ LINVIEW: ¡Incremental ¡View ¡Maintenance ¡ for ¡Complex ¡Analy;cal ¡Queries ¡ ¡ Milos ¡Nikolic, ¡Mohammed ¡El ¡Seidy, ¡Christoph ¡Koch ¡ DATA, ¡EPFL ¡ ¡ SIGMOD, ¡24 th ¡June ¡2014 ¡ ¡

  2. Big ¡Data ¡Analy;cs ¡ Simple (SQL) Analytics Complex (non-SQL) Analytics Machine Learning Data Warehouses (OLAP) Scientific Computing Data Mining 2 ¡

  3. Complex ¡Analy;cal ¡Queries ¡ § ORen ¡expressed ¡as ¡linear ¡algebra ¡on ¡array ¡data ¡ ¡ Example: Ordinary Least Squares Y = X β β * = (X T X) -1 X T Y X, Y, β , β * matrices Re-­‑evalua;ng ¡complex ¡queries ¡on ¡ ¡ every ¡(small) ¡change ¡is ¡inefficient ¡ ¡ ¡ => ¡Do ¡it ¡incrementally! ¡ § Mul;dimensional ¡arrays ¡ HIGH ¡DIMENSIONAL: ¡Data ¡processing ¡is ¡increasingly ¡expensive ¡ DYNAMIC: ¡Con;nuously ¡changing, ¡evolve ¡through ¡small ¡changes ¡ (e.g., ¡user’s ¡Internet ¡ac;vity) ¡ § Users ¡want ¡frequently ¡fresh ¡views ¡of ¡data ¡ 3 ¡

  4. Incremental ¡Processing ¡ Update Dataset Computation Recomputation Cheaper Delta Expensive! SQL query + = Result Incremental ¡View ¡Maintenance ¡(IVM) ¡in ¡DBMS ¡(Oracle, ¡DB2, ¡PostgreSQL, ¡…) ¡ 4 ¡

  5. LINVIEW ¡ ¡ Incremental ¡evalua;on ¡of ¡(itera;ve) ¡linear ¡algebra ¡programs ¡ ¡ APL-style LINVIEW compiler programs INCREMENTAL ¡ MAINTENANCE ¡ For instance: MATLAB, R, Octave OPTIMIZER ¡ Matrix operations ( +/-­‑, ¡*, ¡A T , ¡A -­‑1 ) CODE ¡GENERATOR ¡ Incremental programs Basis of ML algos Exec over dynamic data Different runtimes 5 ¡ (Spark, Octave)

  6. Example: ¡Matrix ¡Powers ¡A 4 ¡ + 0 ¡ -­‑1 ¡ 5 ¡ 0 ¡ 0 ¡ 0 ¡ 0 ¡ -­‑1 ¡ 5 ¡ = 3 ¡ 4 ¡ 1 ¡ 0 ¡ 0 ¡ -­‑2 ¡ 3 ¡ 4 ¡ -­‑1 ¡ -­‑2 ¡ 1 ¡ -­‑3 ¡ -­‑2 ¡ 1 ¡ -­‑3 ¡ 0 ¡ 0 ¡ 0 ¡ A ¡ ΔA ¡ A ¡ + ¡ ΔA ¡ Delta Matrix A ¡ = ¡ A ¡ + ¡ ΔA ¡ B ¡ = ¡ A ¡ A ¡ ΔB ¡ = ¡ ... ¡ B ¡ = ¡ A ¡ A ¡ Incremental C ¡ = ¡ B ¡ B ¡ ΔC ¡ = ¡ ... ¡ C ¡ = ¡ B ¡ B ¡ Program B ¡ += ¡ ΔB ¡ C ¡ += ¡ ΔC ¡ O(n 3 ) ¡ O(n 2 ) ¡ O(n 3 ) ¡ ¡35 ¡ -­‑47 ¡ 224 ¡ 22 ¡ 4 ¡ 0 ¡ 57 ¡ -­‑43 ¡ 224 ¡ + = ¡154 ¡ ¡254 ¡ ¡64 ¡ -­‑42 ¡ -­‑54 ¡-­‑120 ¡ 112 ¡ 200 ¡ -­‑56 ¡ -­‑87 ¡ 51 ¡ -­‑96 ¡ -­‑6 ¡ -­‑12 ¡ 16 ¡ -­‑93 ¡ 39 ¡ -­‑80 ¡ C ¡ ΔC ¡ C ¡ + ¡ ΔC ¡ 6 ¡

  7. IVM ¡of ¡Linear ¡Algebra ¡ ¡ON ¡UPDATE ¡A ¡BY ¡ΔA: ¡ ¡ON ¡UPDATE ¡A ¡BY ¡ΔA: ¡ ¡ ¡ ¡ΔB ¡= ¡A(ΔA) ¡ + ¡ (ΔA)A ¡ + ¡ (ΔA)(ΔA) ¡ ¡ ¡ ¡A ¡+= ¡ΔA ¡ ¡ ¡ ¡ΔC ¡= ¡B(ΔB) ¡ + ¡ (ΔB)B ¡ + ¡ (ΔB)(ΔB) ¡ ¡ ¡ ¡B ¡= ¡A ¡ A ¡ ¡ ¡ ¡A ¡+= ¡ΔA ¡ ¡ ¡ ¡C ¡= ¡B ¡ B ¡ O(n 3 ) O(n 2 ) ¡ ¡ ¡B ¡+= ¡ΔB ¡ ¡ ¡ ¡C ¡+= ¡ΔC ¡ … when Δ A is “simple” How ¡to ¡ ¡ ¡ ¡… ¡derive ¡delta ¡expressions? ¡ ¡ ¡… ¡evaluate ¡delta ¡expressions? ¡ ¡ ¡… ¡represent ¡delta ¡expressions? ¡ 7 ¡

  8. Delta ¡Deriva;on ¡ § Exploits ¡proper;es ¡of ¡matrix ¡opera;ons ¡ (e.g., ¡distribu;vity ¡of ¡matrix ¡mul;plica;on ¡over ¡addi;on) ¡ ¡ Example: ¡ ¡ ¡ ¡ ¡ ¡ B[A] ¡= ¡A ¡ A ¡ ¡ ¡ ¡ ¡ (consider ¡B ¡as ¡a ¡function ¡of ¡A) ¡ ¡ ¡ ¡ ¡ ¡ΔB[A,ΔA] ¡= ¡B[A ¡ + ¡ ΔA] ¡ – ¡ B[A] ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡= ¡(A ¡ + ¡ ΔA)(A ¡ + ¡ ΔA) ¡ – ¡ A ¡ A ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡= ¡A(ΔA) ¡ + ¡ (ΔA)A ¡ + ¡ (ΔA)(ΔA) ¡ ¡ § The ¡Sherman–Morrison ¡formula ¡for ¡maintaining ¡(A ¡+ ¡ΔA) -­‑1 ¡ 8 ¡

  9. Delta ¡Evalua;on: ¡The ¡Avalanche ¡Effect ¡ 0 ¡ -­‑1 ¡ 5 ¡ 0 ¡ 0 ¡ 0 ¡ 0 ¡ 0 ¡ 0 ¡ 0 ¡ -­‑1 ¡ 5 ¡ 0 ¡ 0 ¡ 2 ¡ + = 3 ¡ 4 ¡ 1 ¡ 0 ¡ 0 ¡ -­‑2 ¡ 0 ¡ 0 ¡ -­‑2 ¡ 3 ¡ 4 ¡ -­‑1 ¡ 4 ¡ -­‑2 ¡ -­‑2 ¡ -­‑2 ¡ 1 ¡ -­‑3 ¡ 0 ¡ 0 ¡ 0 ¡ 0 ¡ 0 ¡ 0 ¡ -­‑2 ¡ 1 ¡ -­‑3 ¡ 0 ¡ 0 ¡ -­‑2 ¡ A ¡ ΔA ¡ ΔA ¡ A ¡ + ¡ ΔA ¡ ΔB ¡ -­‑13 ¡ 1 ¡-­‑16 ¡ 0 ¡ 0 ¡ 2 ¡ 0 ¡ 0 ¡ 2 ¡ -­‑13 ¡ 1 ¡ -­‑14 ¡ 22 ¡ 4 ¡ 0 ¡ + = 10 ¡ 14 ¡ 16 ¡ 4 ¡ -­‑2 ¡ -­‑2 ¡ 4 ¡ -­‑2 ¡ -­‑2 ¡ 14 ¡ 12 ¡ 14 ¡ -­‑42 ¡ -­‑54 ¡ -­‑120 ¡ 9 ¡ 3 ¡ 0 ¡ 0 ¡ 0 ¡ -­‑2 ¡ 0 ¡ 0 ¡ -­‑2 ¡ 9 ¡ 3 ¡ -­‑2 ¡ -­‑6 ¡ -­‑12 ¡ 16 ¡ ΔB ¡ B ¡ ΔB ¡ B ¡+ ¡ΔB ¡ ΔC ¡ A ¡single-­‑entry ¡change ¡contaminates ¡the ¡whole ¡output ¡=> ¡ Ω(n 2 ) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Delta ¡computa;on ¡involves ¡ O(n 3 ) ¡matrix ¡mul;plica;on ¡ ¡ ¡ ¡ ¡ ¡IVM ¡loses ¡its ¡performance ¡benefit ¡over ¡re-­‑evalua;on ¡ How ¡to ¡confine ¡the ¡avalanche ¡effect? ¡ 9 ¡

  10. Delta ¡Representa;on ¡ § Deltas ¡as ¡single ¡matrices ¡ ✗ ¡ ¡quickly ¡escalate ¡to ¡full ¡matrices, ¡involve ¡ O(n 3 ) ¡ops ¡ ¡ ¡ § Insight: ¡delta ¡matrices ¡have ¡low ¡ranks ¡ ✓ represent ¡as ¡vector ¡outer ¡products ¡ 0 ¡ 0 ¡ 0 ¡ 0 ¡ 0 ¡ 0 ¡ -­‑2 ¡ ΔA ¡= ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡= ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡= ¡ u ¡ v T ¡ 0 ¡ 0 ¡ -­‑2 ¡ 1 ¡ 0 ¡ 0 ¡ 0 ¡ 0 ¡ § Factored ¡representa;on ¡admits ¡efficient ¡evalua;on ¡ 10 ¡

  11. Revisited: ¡Matrix ¡Powers ¡A 4 ¡ rank-s, efficient when s << n ΔA ¡ is a rank-1 update --------- ΔA ¡ = ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ = ¡u ¡ v T ¡ ¡ (e.g., changes of one row/column) O(n 2 ) ¡ O(n 2 ) ¡ ΔB ¡ = ¡ ¡ + ¡ ... ¡ ¡ + ¡ ¡ v T ¡ v T ¡ A ¡ u ¡ u ¡ A ¡ ¡ 0 ¡ 0 ¡ 2 ¡ ¡ ¡ ¡ = ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡+ ¡ ¡ 4 ¡ -­‑2 ¡ -­‑2 ¡ ¡= ¡ ¡ 0 ¡ 0 ¡ -­‑2 ¡ ΔC ¡ = ¡a ¡sum ¡of ¡4 ¡outer ¡products ¡ ¡ Delta ¡computa;on ¡involves ¡only ¡ O(n 2 ) ¡opera;ons! ¡ 11 ¡

  12. IVM ¡of ¡Itera;ve ¡Programs ¡ § Many ¡programs ¡in ¡prac;ce ¡converge ¡within ¡only ¡a ¡few ¡itera;ons ¡ ¡ ¡ ¡ ¡ ¡ (e.g., ¡80.7% ¡of ¡pages ¡in ¡PageRank ¡converge ¡in ¡less ¡than ¡15 ¡itera;ons 1 ) ¡ ¡ § Example: ¡ ¡ ¡ T i ¡ = ¡ f(A, ¡ B, ¡ T i-­‑1 ) ¡ = ¡ A ¡ T i-­‑1 ¡ + ¡ B ¡ Init Result States Iterative function f ¡ f ¡ A,B ¡ . . . T 0 ¡ T 1 ¡ T 2 ¡ T k ¡ T k ¡ 1. Materialize Incremental ¡ Δf ¡ Δf ¡ Δf ¡ 2. Derive deltas evalua;on ¡ 3. Update A+ΔA,B ¡ f ¡ f ¡ . . . T 0 ¡ T’ 1 ¡ T’ 2 ¡ T’ k ¡ T’ k ¡ Re-­‑evalua;on ¡(expensive!) ¡ ¡ [1] ¡S. ¡Kamvar, ¡T. ¡Haveliwala, ¡and ¡G. ¡Golub. ¡Adap;ve ¡methods ¡for ¡the ¡computa;on ¡of ¡PageRank. ¡Technical ¡report, ¡Stanford, ¡2003 ¡

  13. Time ¡Complexity ¡ (rank-­‑1 ¡updates, ¡big-­‑O ¡nota;on) ¡ Incremental ¡ Re-­‑evalua(on ¡ maintenance ¡ Ordinary ¡Least ¡Squares ¡ n 3 ¡ n 2 ¡ Matrix ¡Powers ¡A k ¡ n 3 ¡ log ¡ k ¡ n 2 ¡ k ¡ T i+1 ¡= ¡A ¡ T i ¡+ ¡B ¡ n 3 ¡ log ¡ k ¡ n 2 ¡ k ¡ where ¡T ¡= ¡(n ¡x ¡n) ¡ T i+1 ¡= ¡A ¡ T i ¡+ ¡B ¡ n 2 ¡ k ¡ n 2 ¡ k ¡ where ¡T ¡ = ¡ (n ¡x ¡1) ¡ IVM ¡has ¡lower ¡;me ¡ A – dimension (n x n) complexity ¡in ¡most ¡cases! ¡ k – number of iterations But ¡increases ¡memory ¡consump;on ¡(log ¡ k ¡;mes, ¡details ¡in ¡paper) ¡ 13 ¡

  14. Experimental ¡Setup ¡ § Analy;cs: ¡OLS, ¡matrix ¡powers, ¡GD ¡for ¡lin. ¡regression, ¡… ¡ § Apache ¡Spark ¡ o EC2 ¡cluster: ¡100 ¡workers ¡(8 ¡vCPUs, ¡13.6GB ¡RAM, ¡10GbE) ¡ § GNU ¡Octave ¡ o 2 ¡x ¡2.66GHz ¡6-­‑Core ¡Intel ¡Xeon, ¡64GB ¡RAM ¡ § Randomly ¡generated ¡dense ¡matrices ¡ o Precondi;oned ¡for ¡numerical ¡stability ¡ § Stream ¡of ¡rank-­‑1 ¡updates ¡ o Each ¡update ¡affects ¡one ¡row ¡of ¡the ¡input ¡matrix ¡ 14 ¡

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend