Category: Python

  1. Updated

    Build a recommender system with Spark: Implicit ALS

    Category: AI, Big Data, Python

    在本篇文章中,我們以 Candidate Generation 階段常用的方法之一:Collaborative Filtering 協同過濾演算法為例,利用 Apache Spark 的 ALS (Alternating Least Squares) 模型建立一個 GitHub repositories 的推薦系統,以用戶對 repo 的打星紀錄作為訓練數據,推薦出用戶可能會感興趣的其他 repo 作為候選物品集。

  2. Updated

    Spark ML cookbook (Python)

    Category: AI, Big Data, Python

    As of Spark 2.0, the RDD-based APIs in the spark.mllib package have entered maintenance mode. The primary Machine Learning API for Spark is now the DataFrame-based API in the spark.ml package.

  3. Updated

    Spark SQL cookbook (Python)

    Category: AI, Big Data, Python

    Spark SQL is a Spark module for structured data processing. Unlike the basic Spark RDD API, the interfaces provided by Spark SQL provide Spark with more information about the structure of both the data and the computation being performed.

  4. Updated

    Spark RDD methods (Python / Scala)

    Category: AI, Big Data, Python

    以下的 methods 有些是所有 RDD 都能用,有些則是 PairRDD 才有的功能。然後因為在不同的 projects 我先後用了 Spark 的 Python API 和 Scala API,所以以下的內容可能會混雜著兩者的範例。Scala API 要特別注意每個 method 接受和回傳的 type 的差異;Python API 就沒有這種限制了,畢竟是動態語言。

  5. Updated

    Setup Spark on macOS

    Category: AI, Big Data, Python

    Install Spark on macOS with Homebrew or the pre-built tarball. You need Java 8 JDK first.

  6. Updated

    Functional Programming in Python

    Category: Python

    map() 會讓 list 的每一個元素都會各自經過 func(x) 去處理,最後得到的會是一個新的數量相同的 list。

  7. Updated

    Calculate the similarity of two vectors

    Category: AI, Python

    You should only calculate Pearson Correlations when the number of items in common between two users is > 1, preferably greater than 5/10. Only calculate the Pearson Correlation for two users where they have commonly rated items.

  8. Updated

    Simple Parallel Tasks in Python: concurrent.futures

    Category: Python

    concurrent.futures is well suited to Embarrassingly Parallel tasks. You could write concurrent code with a simple for loop.

  9. Updated

    Create a custom migration in Django

    Category: Database, Python

    ALTER TABLE app_repostarring CHANGE repo_description repo_description VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

  10. Updated

    Lazy evaluation in Django middlewares

    Category: Python, Web Development

    Attach a lazy evaluated function as a property of request in a middleware.