Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

PRINCE: Provider-side Interpretability with Counterfactual Explanations in Recommender Systems

Author: Azin Ghazimatin (


In this repository, we provide the code for generating counterfactual explanations in random walk-based recommender systems in polynomial time. The explanations are in form of a subset of the user's actions, whose removal displaces the top-most recommendation. User's actions are modeled as the outgoing edges of the user's node in her interaction graph.


The relevance of the items to a user is measured based on the their PageRank scores personalized for the user. In, the PPR (personalized PageRank) scores are computed using reverse local push algorithm (with approximation guarantee of epsilon). For a given user and her interction graph, the function "cfe_item_centric_algo_poly" in returns the counterfactual explanation and the replacement item (the new top-most recommendation).


In, the algorithm is tested on random graphs. For example, in the graph below, the user node is shown in red (node 12). The only item nodes in the graph are nodes 13 an 14. Node 14 has higher PageRank score, hence the top recommendation. Deleting the red edges swaps the rank of the nodes 13 and 14, and makes node 13 the new top recommendation.


You can’t perform that action at this time.