|
Before we go deeper into the technical detail of each of the different steps, let’s have a look at how a typical report that uses our application would look like.
As we see from the video this interactive report would be a tool that would be used by reporting analysts, planners, management and other business personas to get a deep insight into the drivers that have an impact on the final forecasts.
Note: The example report shows forecasts where historical data is also available but it would work exactly the same with no limitations for future forecasts as well since the method is focusing on explaining the prediction of a machine learning model without taking actual data into consideration. |
Now let’s have a look at how you can build a similar report and tailor it to the business needs of your organisation.
fetch(
window.origin +
'/casManagement/providers/cas/sources/cas-shared-default/children?limit=100&sortBy=name%3Aascending&start=0',
{
// mode: 'no-cors',
method: 'GET',
headers: {
Accept: 'application/json',
},
}
).then((response) => {
if (response.ok) {
// Do stuff here
}))
function onDataReceived(resultData) {
ID.value = resultData.data[0];
}
va.messagingUtil.setOnDataReceivedCallback(onDataReceived);
fetch(jeeURI, {
method: 'GET',
})
.then((resp) => {
console.log('Response');
SPINNER.style.display = 'none';
FORM.style.display = 'block';
})
.then((body) => {
console.log('Success');
})
.catch((error) => {
console.log('Error');
});
});
Note: The code above is written in Javascript and included inline in the HTML form.
|
Variable name in the code | Description |
caslib_ds |
CASLIB of the scoring table
|
name_ds |
Scoring table
|
caslib_m | CASLIB of the model table (score code) |
name_m | Model table (score code) |
id_name | Unique ID variable |
id | Query ID |
proc astore;
ods output InputVariables=work.inputs;
ods output OutputVariables=work.outputs;
describe rstore=&caslib_m..&name_m.;
run;
data casuser.query;
set &caslib_ds..&name_ds.(where=(&id_name=&id));
run;
explainModel.linearExplainer result=globr / table = {name='PRICEDATA_ID', caslib='PUBLIC'}
query = {name='QUERY', caslib='CASUSER'}
modelTable = {name='GB_PRICEDATA_MODEL_ID', caslib='MODELS'}
modelTableType = 'ASTORE'
predictedTarget = 'P_sale'
seed=1234
preset = 'GlobalReg'
dataGeneration = {method='None'}
inputs= {{name = "sale_lag3"},
{name = "sale_lag2"},
{name = "sale_lag1"},
{name = "discount"},
{name = "price"}}
;run;
send_response({gr=globr['ParameterEstimates']});run;
proc cas;
session casauto;
loadactionset "explainModel";
loadactionset "sccasl";
source pgm_g;
%include pgm_g;
endsource;
run;
sccasl.runCASL result=r / code=pgm_g;
run;
describe r;
param_est=findtable(r);
saveresult param_est dataout=work.parameterEstimates;
quit;
explainModel.linearExplainer result=shapr / table = {name='PRICEDATA_ID', caslib='PUBLIC'}
query = {name='QUERY', caslib='CASUSER'}
modelTable = {name='GB_PRICEDATA_MODEL_ID', caslib='MODELS'}
modelTableType = 'ASTORE'
predictedTarget = 'P_sale'
seed =1234
preset = 'KERNELSHAP'
dataGeneration = {method='None'}
inputs= {{name = "sale_lag3"},
{name = "sale_lag2"},
{name = "sale_lag1"},
{name = "discount"},
{name = "price"}}
;run;
send_response({sr=shapr['ParameterEstimates']});run;
The result tables will be stored/refreshed to CAS and can be accessed and visualized by the SAS Visual Analytics report everytime a user clicks the "Execute" button.
This concludes our series of articles. We hope you enjoyed reading them and found them useful. We've touched upon many different topics so don't despair if some areas are still unclear - this is perfectly normal. What we hope you take out from these articles is a good understanding of Machine Learning techniques in forecasting and how you can cleverly apply existing state-of-the-art techniques to explain your forecasts. In the last article, we've also shown how you can create a custom application to dynamically run explainability techniques on the fly using SAS Viya's powerful capabilities. The final application provides strong insights in your forecasts and is extremely easy to use by any business stakeholder. As a last thought we want to mention that explainability in forecasting has attracted the attention of many researchers recently and we expect a lot of new exciting developments in this area. As always, we'll make sure to keep you updated!
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
The rapid growth of AI technologies is driving an AI skills gap and demand for AI talent. Ready to grow your AI literacy? SAS offers free ways to get started for beginners, business leaders, and analytics professionals of all skill levels. Your future self will thank you.