BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Edoedoedo
Pyrite | Level 9

I've successfully created an autoencoder model using the annTrain action.

Now I want to add explanation to a single prediction using SHAP method (as in https://arxiv.org/pdf/1903.02407.pdf).

I see that the linearExplainer action supports the SHAP method (https://documentation.sas.com/?docsetId=casactml&docsetTarget=casactml_linearexplainer_syntax.htm&do...) but it requires a target variable.

Since the autoencoder model does not have a target variable (i.e. the input variables are the targets), what can I do?

 

Thanks

Regards

1 ACCEPTED SOLUTION

Accepted Solutions
RalphAbbey
SAS Employee

EduxEdux,

 

The linearExplainer action, which supports the SHAP Kernel method for estimating Shapley values does require a "predicted target." However, in your case, you have multiple "predicted targets" as the paper about Shapley values on autotunecoders suggests. While the autoencoder is trying to predict what each input variable is, the linearExplainer action wants to know the name of the output variable.

 

The only complication I can see is if the annTrain autoencode has the same output variable names as input variable names. As long as they are different names, derived or otherwise, then you should be able to use the linearExplainer action.

 

For the "predictedTarget" parameter, instead use the output variable name corresponding to the input variable that you wish to examine. As the paper says, you first need to consider the top variables which are different between input and output (and thus you'd need different names in SAS anyway, otherwise you'd overwrite). When you go to use the linearExplainer action, use that output variable name as the "predictedTarget".

 

Hopefully this is clear, let me know if I can help further!

 

-Ralph

View solution in original post

2 REPLIES 2
RalphAbbey
SAS Employee

EduxEdux,

 

The linearExplainer action, which supports the SHAP Kernel method for estimating Shapley values does require a "predicted target." However, in your case, you have multiple "predicted targets" as the paper about Shapley values on autotunecoders suggests. While the autoencoder is trying to predict what each input variable is, the linearExplainer action wants to know the name of the output variable.

 

The only complication I can see is if the annTrain autoencode has the same output variable names as input variable names. As long as they are different names, derived or otherwise, then you should be able to use the linearExplainer action.

 

For the "predictedTarget" parameter, instead use the output variable name corresponding to the input variable that you wish to examine. As the paper says, you first need to consider the top variables which are different between input and output (and thus you'd need different names in SAS anyway, otherwise you'd overwrite). When you go to use the linearExplainer action, use that output variable name as the "predictedTarget".

 

Hopefully this is clear, let me know if I can help further!

 

-Ralph

Edoedoedo
Pyrite | Level 9

You're right, thank you very much I didn't thing to run the linearExplainer one predictedTarget at time.

It works great!

 

Regards

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 2092 views
  • 0 likes
  • 2 in conversation