LIME Procedure

Getting Started: LIME Procedure

Note: Input data must be in a CAS table that is accessible in your CAS session. You must refer to this table by using a two-level name. The first level must be a CAS engine libref, and the second level must be the table name. For more information, see the sections Using CAS Sessions and CAS Engine Librefs and Loading a SAS Data Set onto a CAS Server in Chapter 2, Shared Concepts.

This example uses the LIME procedure to explain a prediction that is made by a forest model.

The following DATA step creates the input data table mylib.dmagecr. These statements assume that your CAS engine libref is named mylib, but you can substitute any appropriately defined CAS engine libref.

data mylib.dmagecr;
   set sampsio.dmagecr;
   id = _N_;
   keep age amount coapp duration foreign job good_bad id;
run;

The following DATA step creates the query data table mylib.query in your CAS session:

data mylib.query;
   set sampsio.dmagecr;
   keep age amount coapp duration foreign job good_bad;
   if _N_ = 20;
run;

The following statements use the FOREST procedure to build a forest model to predict whether the credit rating of each individual in the mylib.dmagecr data table is good or bad. The procedure also outputs an analytic store named forest_astore.

proc forest
   data=mylib.dmagecr
   seed=1234;
   input age amount duration / level=interval;
   input coapp foreign job /level=nominal;
   target good_bad;
   savestate rstore=mylib.forest_astore;
run;

The following statements run PROC LIME and produce ODS tables of the results:

proc lime
   data=mylib.query
   referenceData=mylib.dmagecr
   seed=12345;
   input age amount duration / level=interval;
   input coapp foreign job /level=nominal;
   predictedTarget P_good_badbad;
   astoreModel rstore=mylib.forest_astore;
run;

The DATA= option names the input query data table, which specifies the data to use for LIME value calculation. The REFERENCEDATA= option names the reference data table. The SEED= option specifies the seed to use for pseudorandom number generation. The two INPUT statements specify that age, amount, and duration are the interval variables and coapp, foreign, and job are the nominal variables. The PREDICTEDTARGET statement specifies that P_good_badbad be used as the predicted target variable. The ASTOREMODEL statement specifies the analytic store that contains the model to explain.

Figure 1 displays the explainer information. Figure 2 displays the LIME values for the query observation, which are the estimated parameters of the local regression model. Figure 3 displays the explainer fidelity information.

Figure 1: Explainer Information

The LIME Procedure

Explainer Information
Data Generation MethodQuery Centered
Distance MethodNormalized Euclidean with Exponential Kernel
Explainer TypeRegression with LASSO
Binary EncodingNone
Standardize Parameter EstimatesNone
Include Missing as a LevelNo
Number of Samples3000
Exponential Kernel Divisor1.8371173071
Mixed Distance Weight1
Seed12345


Figure 2: Parameter Estimates

Parameter Estimates
VariableNominal VariablesEstimateQuery Level
coappforeignjob
Intercept...0.3190324769.
age...-0.00554829831
amount...-5.169254E-63430
duration...0.006700450524
coapp2..0.11280666070
coapp3..-0.0392848150
coapp1..01
foreign.2.-0.1554675230
foreign.1.01
job..10.07525797720
job..20.03914287930
job..301


Figure 3: Explainer Fidelity

Explainer Fidelity
Model PredictionExplainer PredictionExplainer RMSE
0.32768718730.29011549940.0947577628


Last updated: August 06, 2026