Runtime Recommendation Scorers

At runtime the Seldon server can utilize a set of item recommendation scorers to provide recommendations. These runtime scorers are usually based on some offline model.

The current built in runtime scorers are as follows:

Runtime Scorer Offline Model
Static Matrix Factorization Scorer matrix factorization model
Recent Activity Matrix Factorization Scorer matrix factorization model
User Clusters Matrix Factorization Scorer user clusters matrix factorization model
Item Similarity Scorer item activity model
Recent Most Popular  
Recent Activity  
Custom Scorer  

Applying a Configuration

Use the seldon-cli to apply a configuation to a client.

Static Matrix Factorization Scorer

Utilizes the derived offline latent factors to provide a set of recommendations for a user.

Example activation of a runtime scorer for a client ml100k::

cat <<EOF | seldon-cli rec_alg --action create --client-name ml100k -f -
{
    "defaultStrategy": {
        "algorithms": [
            {
                "config": [
                    {
                        "name": "io.seldon.algorithm.general.numrecentactionstouse",
                        "value": "1"
                    }
                ],
                "filters": [],
                "includers": [],
                "name": "mfRecommender"
            }
        ],
        "combiner": "firstSuccessfulCombiner"
    },
    "recTagToStrategy": {}
}
EOF

seldon-cli rec_alg --action commit --client-name ml100k

Recent Activity Matrix Factorization Scorer

Uses the recent item interactions to create a snapshot latent representation of the user from the item factors and use that to recommend new content.

Optional config setting for this algorithm are:

Example activation of a runtime scorer for a client ml100k:

cat <<EOF | seldon-cli rec_alg --action create --client-name ml100k -f -
{
    "defaultStrategy": {
        "algorithms": [
            {
                "config": [
                    {
                        "name": "io.seldon.algorithm.general.numrecentactionstouse",
                        "value": "1"
                    }
                ],
                "filters": [],
                "includers": [],
                "name": "recentMfRecommender"
            }
        ],
        "combiner": "firstSuccessfulCombiner"
    },
    "recTagToStrategy": {}
}
EOF

seldon-cli rec_alg --action commit --client-name ml100k

User Clusters Matrix Factorization Scorer

Utilizes the derived offline latent factors to provide a set of recommendations for a user in a cluster.

Example activation of a runtime scorer for a client ml100k::

cat <<EOF | seldon-cli rec_alg --action create --client-name ml100k -f -
{
    "defaultStrategy": {
        "algorithms": [
            {
                "config": [
                    {
                        "name": "io.seldon.algorithm.general.numrecentactionstouse",
                        "value": "1"
                    }
                ],
                "filters": [],
                "includers": [],
                "name": "mfUserClustersRecommender"
            }
        ],
        "combiner": "firstSuccessfulCombiner"
    },
    "recTagToStrategy": {}
}
EOF

seldon-cli rec_alg --action commit --client-name ml100k

Item Similarity

Uses the recent item interactions to find a set of top scoring similar items to recommend

Example activation of a runtime scorer for a client ml100k:

cat <<EOF | seldon-cli rec_alg --action create --client-name ml100k -f -
{
    "defaultStrategy": {
        "algorithms": [
            {
                "config": [
                    {
                        "name": "io.seldon.algorithm.general.numrecentactionstouse",
                        "value": "1"
                    }
                ],
                "filters": [],
                "includers": [],
                "name": "itemSimilarityRecommender"
            }
        ],
        "combiner": "firstSuccessfulCombiner"
    },
    "recTagToStrategy": {}
}
EOF

seldon-cli rec_alg --action commit --client-name ml100k

This recommender can be used to serve most popular recommendations. It counts which items are being read with a exponentially decaying score to control how fast old article counts are forgotton.

Example config:

cat <<EOF | seldon-cli rec_alg --action create --client-name ml100k -f -
{
    "defaultStrategy": {
        "algorithms": [
            {
                 "config": [
                    {
                        "name": "io.seldon.algorithm.clusters.decayratesecs",
                        "value": "10800"
                    },
                    {
                        "name": "io.seldon.algorithm.clusters.usebucketcluster",
                        "value": "true"
                    }
                ],
                "filters": [],
                "includers": [],
                "name": "globalClusterCountsRecommender"
            }
        ],
        "combiner": "firstSuccessfulCombiner"
    },
    "recTagToStrategy": {}
}
EOF

seldon-cli rec_alg --action commit --client-name ml100k

The above configuration ensures:

Recent Activity

Return the most recently added items, e.g., in a news setting the most recent published articles.

Example config:

cat <<EOF | seldon-cli rec_alg --action create --client-name ml100k -f -
{
    "defaultStrategy": {
        "algorithms": [
            {
                "config": [],
                "filters": [],
                "includers": [],
                "name": "recentItemsRecommender"
            }
        ],
        "combiner": "firstSuccessfulCombiner"
    },
    "recTagToStrategy": {}
}
EOF

seldon-cli rec_alg --action commit --client-name ml100k

Custom Scorer

Seldon allows you to deploy your own recommendation runtime scorer using its microservices as described here

Configuration parameters:

Example config:

cat <<EOF | seldon-cli rec_alg --action create --client-name ml100k -f -
{
    "defaultStrategy": {
        "algorithms": [
            {
                "config": [
                    {
                        "name": "io.seldon.algorithm.inclusion.itemsperincluder",
                        "value": 1000
                    },
                    {
                        "name": "io.seldon.algorithm.external.url",
                        "value": "http://service_hostname:5000/recommend"
                    },
                    {
                        "name": "io.seldon.algorithm.external.name",
                        "value": "external_model_name"
                    }
                ],
                "filters": [],
                "includers": [
                    "recentItemsIncluder"
                ],
                "name": "externalItemRecommendationAlgorithm"
            }
        ],
        "combiner": "firstSuccessfulCombiner"
    },
    "recTagToStrategy": {}
}
EOF

seldon-cli rec_alg --action commit --client-name ml100k

Seldon running inside Kubernetes provides a utility script start-microservice to start a recommendation microservice packaged as a Docker container.