Choosing an Influence Algorithm¶
TruEra offers two algorithms to generate influences: SHAP and QII. In the discussion that follows, you'll learn when it's appropriate to use one over the other and how to set the influence algorithm type for your project(s).
What are influences?
Influences are a measure of how much a feature contributed to an outcome, such as a model's prediction. In the TruEra system, we generate influences by computing Shapley values. Check out our primer on influences for details on how influences are generated.
Computing Influence¶
Feature influences can be computed using one of two methods:
- Quantitative Input Influence (QII): TruEra's proprietary methods to efficiently calculate unbiased estimates of Shapley values for a variety of models.
- SHapley Additive exPlanations (SHAP): An open-source framework to estimate Shapley values, using a slightly different method.
SHAP is a free, open-source package and is thus available to all users of TruEra. With SHAP, you can use most TruEra functionality via our local compute package of the TruEra SDK, from which you can create projects and models on your own machine, upload them to a TruEra deployment, and gain access to basic analysis.
Be aware, however, that SHAP can give inaccurate explanations for a variety of models, and is much slower than QII for many common model frameworks. In addition, if you wish to ingest a model directly into a TruEra deployment, this is only possible with access to our proprietary QII package. If it is available to you, we strongly recommend using QII. See the benchmarks for more on QII advantages.
How can I get QII?
If you don't already have access, reach out to us at support@truera.com.
Setting/Changing the Influence Algorithm Type¶
In most cases, you don't need to worry about the influence algorithm type. TruEra will automatically detect the packages you have installed when running the SDK, and set the algorithm type appropriately. If you have QII installed, we'll default to that, and otherwise use SHAP. To change this, you can use the tru.set_influence_type()
method in the SDK. Once your influence type is set, influences are automatically be computed using the appropriate algorithm using tru.get_feature_influences()
call, and you can upload these influences to the deployment of your choice with tru.upload_project()
. If you are uploading externally compute influences to a virtual model, you may to have to specify the influence algorithm type in accordance with the requirements of tru.add_model_feature_influences()
.
You can set the influence type for your project in the Web App by selecting the appropriate option on the Settings page:
An important note about QII
TruEra QII analysis is unavailable without licensed access. Without QII, you must compute influences externally, then add them to your model using the SDK's add_model_feature_influences()
method. If you don't have access to QII, reach out to truera.support.com.
Click Next below to continue.