rec_model: Azure product recommendations model class

Description Format Methods Initialization Recommendations See Also Examples

Description

Class representing an individual product recommendations (SAR) model.

Format

An R6 object of class rec_model.

Methods

Initialization

Generally, the easiest way to initialize a new model object is via the get_model() and train_model() methods of the rec_endpoint class, which will handle all the gory details.

Recommendations

These arguments are used for obtaining personalised and item-to-item recommendations.

Both the user_predict() and item_predict() methods return a data frame with the top-K recommendations and scores.

See Also

az_rec_service for the service backend, rec_endpoint for the client endpoint

API reference and SAR model description at the Product Recommendations API repo on GitHub

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Not run: 

# get a recommender endpoint and previously-trained model
rec_endp <- rec_endpoint$new("myrecusacvjwpk4raost", admin_key="key1", rec_key="key2")
rec_model <- rec_endp$get_model("model1")

data(ms_usage)

# item recommendations for a set of user IDs
users <- unique(ms_usage$user)[1:5]
rec_model$user_predict(users)

# item recommendations for a set of user IDs and transactions (assumed to be new)
user_df <- subset(ms_usage, user %in% users)
rec_model$user_predict(user_df)

# item recomendations for a set of item IDs
items <- unique(ms_usage$item)[1:5]
rec_model$item_predict(items)


## End(Not run)

SAR documentation built on Oct. 23, 2020, 7:55 p.m.