Class: MatrixFactorizationModel

eclairjs/mllib/recommendation.MatrixFactorizationModel

new MatrixFactorizationModel(rank, userFeatures, productFeatures)

Parameters:
Name Type Description
rank number
userFeatures module:eclairjs/rdd.RDD
productFeatures module:eclairjs/rdd.RDD
Source:

Methods

(static) load(sc, path) → {module:eclairjs/mllib/recommendation.MatrixFactorizationModel}

Load a model from the given path. The model should have been saved by save.
Parameters:
Name Type Description
sc module:eclairjs.SparkContext Spark context used for loading model files.
path string Path specifying the directory to which the model was saved.
Source:
Returns:
Model instance
Type
module:eclairjs/mllib/recommendation.MatrixFactorizationModel

predict(user, Optional) → {Promise.<number>|RDD}

Parameters:
Name Type Description
user number | RDD
Optional number product
Source:
Returns:
Type
Promise.<number> | RDD

productFeatures() → {module:eclairjs/rdd.RDD}

Source:
Returns:
Type
module:eclairjs/rdd.RDD

recommendProducts(user, num) → {Array.<module:eclairjs/mllib/recommendation.Rating>}

Recommends products to a user.
Parameters:
Name Type Description
user number the user to recommend products to
num number how many products to return. The number returned may be less than this. "score" in the rating field. Each represents one recommended product, and they are sorted by score, decreasing. The first returned is the one predicted to be most strongly recommended to the user. The score is an opaque value that indicates how strongly recommended the product is.
Source:
Returns:
[[Rating]] objects, each of which contains the given user ID, a product ID, and a
Type
Array.<module:eclairjs/mllib/recommendation.Rating>

recommendProductsForUsers(num) → {module:eclairjs/rdd.RDD}

Recommends topK products for all users.
Parameters:
Name Type Description
num number how many products to return for every user. rating objects which contains the same userId, recommended productID and a "score" in the rating field. Semantics of score is same as recommendProducts API
Source:
Returns:
[(Int, Array[Rating])] objects, where every tuple contains a userID and an array of
Type
module:eclairjs/rdd.RDD

recommendUsers(product, num) → {Array.<module:eclairjs/mllib/recommendation.Rating>}

Recommends users to a product. That is, this returns users who are most likely to be interested in a product.
Parameters:
Name Type Description
product number the product to recommend users to
num number how many users to return. The number returned may be less than this. "score" in the rating field. Each represents one recommended user, and they are sorted by score, decreasing. The first returned is the one predicted to be most strongly recommended to the product. The score is an opaque value that indicates how strongly recommended the user is.
Source:
Returns:
[[Rating]] objects, each of which contains a user ID, the given product ID, and a
Type
Array.<module:eclairjs/mllib/recommendation.Rating>

recommendUsersForProducts(num) → {module:eclairjs/rdd.RDD}

Recommends topK users for all products.
Parameters:
Name Type Description
num number how many users to return for every product. of rating objects which contains the recommended userId, same productID and a "score" in the rating field. Semantics of score is same as recommendUsers API
Source:
Returns:
[(Int, Array[Rating])] objects, where every tuple contains a productID and an array
Type
module:eclairjs/rdd.RDD

save(sc, path, overwriteopt) → {Promise.<Void>}

Save this model to the given path. This saves: - human-readable (JSON) model metadata to path/metadata/ - Parquet formatted data to path/data/ The model may be loaded using load.
Parameters:
Name Type Attributes Description
sc module:eclairjs.SparkContext Spark context used to save model data.
path string Path specifying the directory in which to save this model.
overwrite boolean <optional>
overwrites the directory, defaults to false.
Source:
Returns:
A Promise that resolves to nothing.
Type
Promise.<Void>

userFeatures() → {module:eclairjs/rdd.RDD}

Source:
Returns:
Type
module:eclairjs/rdd.RDD