comper_tree_reco_xai
v1.0.6
Published
Explanation system for the recommandation system of the COMPER project
Downloads
5
Readme
reco_explanation
Name
comper tree recommendation explainer.
Description
This package uses the comper recommender traces to display arrows and tooltips explaining the recommendation process to the user, as an overlay of the profile display.
Installation
Import comper_tree_reco_xai with npm :
npm install comper_tree_reco_xai
Usage
Instanciating and displaying explanations :
Everything is done through the Texpl singleton :
import {Texpl} from "comper_tree_reco_xai"
the instance of the singleton is automatically instanciated the first time you will call the getInstance() function.
The first thing to do is to pass the div containing your profile display to the singleton. Example where the div would be named "profileTreeView" :
Texpl.getInstance().setIndentedTree(document.getElementById('profileTreeView'));
To initialise explanations, you will have to ask the COMPER recommendation system to send them to you. For that, you have to add :
["sendTraces", ""] at the end of your objectives list to send to the recommender.
Once the request is treated you should receive the recommendation traces with the rest of the recommendations. You have to pass them to the Texpl singleton. Example where the result of the request to the COMPER recommendation system is received through the variable "res" :
Texpl.getInstance().setTraceText(res.data.traces);
Then, in order to display an explanation, you have to indicate the objective number and the id of the recommendation, which are included in the normal response sent by the COMPER recommendation system :
Texpl.getInstance().initializeExpl(nobj, suggestion.id);
This will display the corresponding explanation for the objective nobj, for the resource suggestion.id
Managing traces :
Before any explanation can be asked through initializeExpl, you will have to give an url where to send your traces to the singleton :
Texpl.getInstance().setTracesURL(url)
with url, a simple string containing the link to your traces database.
You can check if it worked by using
Texpl.getInstance().getTracesConnected()
which should return True, if it worked.
Contributing
For contributing you have to be part of the COMPER project or the following projects. Here is a breakdown of the files and their functions :
arrowsDrawer : Handles the displaying of arrows over the user's profile. It contains the class ArrowDrawer, which have a drawArrow function, which displays an arrow between two provided nodes, if the ArrowDrawer class have been instanciated correctly by providing the div which contains the user profile display.
constants : self explanatory : contains the constants of the project.
Index : the entry point of the project, contains the "Texpl" class, which is a singleton from which all the other functionalities are accessed.
LRSManager : handles the sending of traces to a remote mongodb.
main : contains the global functions launched by the Texpl singleton.
tests : contains some simple tests.
textBuilder : handles the construction of the tooltip texts displayed when clicking on an arrow of an explanation.
traces : processes the traces generated by the COMPER recommendation system.
TracesManager : builds user's traces to send to a traces database, and pass them along to LRSManager.
Authors and acknowledgment
This project was first created by Gabriel Ferrettini for the LIRIS' COMPER project.