LIGHTGRADBOOST Procedure

Getting Started: LIGHTGRADBOOST 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.

A common use of light gradient boosting machine (LightGBM) models is to predict whether a mortgage applicant will default on a loan. The home equity data table Hmeq, which is in the Sampsio library that SAS provides, contains observations for 5,960 mortgage applicants. A variable named Bad indicates whether the applicant, after being approved for a loan, paid off or defaulted on the loan.

This example uses the Hmeq data table to build a LightGBM model that scores the data and can be used to score data about new loan applicants. Table 1 describes the variables in Hmeq.

Table 1: Variables in the Home Equity (Hmeq) Data Table

Variable Role Level Description
Bad Response Binary 1 = applicant defaulted on the loan or is seriously delinquent
0 = applicant paid off the loan
CLAge Predictor Interval Age of oldest credit line in months
CLNo Predictor Interval Number of credit lines
DebtInc Predictor Interval Debt-to-income ratio
Delinq Predictor Interval Number of delinquent credit lines
Derog Predictor Interval Number of major derogatory reports
Job Predictor Nominal Occupational category
Loan Predictor Interval Requested loan amount
MortDue Predictor Interval Amount due on mortgage
nInq Predictor Interval Number of recent credit inquiries
Reason Predictor Binary DebtCon = debt consolidation
HomeImp = home improvement
Value Predictor Interval Value of property
YoJ Predictor Interval Years at present job


For this example, the statements assume that your CAS engine libref is named mylib, but you can substitute any appropriately defined CAS engine libref. You can load the hmeq data set into your SAS library in the following DATA step:

data mylib.hmeq;
   length Bad Loan MortDue Value 8 Reason Job $7
              YoJ Derog Delinq CLAge nInq CLNo DebtInc 8;
   set sampsio.hmeq;
run;

proc print data=mylib.hmeq(obs=10); run;

Figure 1 shows the first 10 observations of mylib.hmeq.

Figure 1: Partial Listing of the mylib.hmeq Data

ObsBadLoanMortDueValueReasonJobYoJDerogDelinqCLAgenInqCLNoDebtInc
1111002586039025HomeImpOther10.50094.36719.
2113007005368400HomeImpOther7.002121.833014.
3115001350016700HomeImpOther4.000149.467110.
411500..  .......
50170097800112000HomeImpOffice3.00093.333014.
6117003054840320HomeImpOther9.000101.4661837.1136
7118004864957037HomeImpOther5.03277.100117.
8118002850243034HomeImpOther11.00088.7660836.8849
9120003270046740HomeImpOther3.002216.933112.
1012000.62250HomeImpSales16.000115.800013.


PROC LIGHTGRADBOOST treats numeric variables as interval inputs unless you specify otherwise. Character variables are always treated as nominal inputs. The following statements run PROC LIGHTGRADBOOST and save the model in a table named mylib.lgbmStore:

proc lightgradboost data=mylib.hmeq validdata=mylib.hmeq
   boosting=DART objective=binary deterministic;
   input Delinq Derog Job nInq Reason / level = nominal;
   input CLAge CLNo DebtInc Loan Mortdue Value YoJ / level = interval;
   target Bad / level = nominal;
   SAVESTATE RSTORE=mylib.lgbmStore ;
   output out=mylib.procout copyvars=(bad loan reason);
   ods output IterHistory=IterHistory;
run;



No parameters are specified in the PROC LIGHTGRADBOOST statement; therefore, the procedure uses all default values. For example, the number of trees in the boosting model is 100, and the number of bins for interval input variables is 255.

The INPUT and TARGET statements are required in order to run PROC LIGHTGRADBOOST. The INPUT statement indicates which variables to use to build the model, and the TARGET statement indicates which variable the procedure predicts.

Figure 2 displays the "Model Information" table. This table shows the values of the training parameters in the first six rows, in addition to some basic information about the trees in the model.

Figure 2: Model Information

The LIGHTGRADBOOST Procedure

Model Information
 cValue
Boosting Methoddart
Objective Typebinary
Number of Bins255
Minimum Leaf Size20
Lasso (L1) Penalty0
Ridge (L2) Penalty0
Maximum Categories32


Figure 3 displays the "Number of Observations" table, which shows how many observations were read and used.

Figure 3: Number of Observations

Number of Observations
Number of Training Observations Read5960
Number of Training Observations Used5960
Number of Validation Observations Read5960
Number of Validation Observations Used5960


Figure 4 displays the "Iteration History" table, which shows evaluation for training and validation data.

Figure 4: Iteration History

Iteration History
Number of TreesTraining Accuracy
Metric
Validation Accuracy
Metric
10.4554590.455459
20.4232710.423271
30.3969650.396965
40.3748070.374807
50.3570850.357085
60.3597520.359752
70.3443400.344340
80.3302930.330293
90.3178160.317816
100.3059860.305986
...
...
...
910.1902240.190224
920.1914540.191454
930.1884700.188470
940.1888440.188844
950.1859420.185942
960.1868900.186890
970.1838370.183837
980.1852370.185237
990.1870950.187095
1000.1886500.188650


Figure 5 displays the "Encoded Name Information" table, which shows the names of predicted probabilities.

Figure 5: Encoded Name Information

Encoded Name Information
Level
Name
Level IDVariable Name
00P_Bad0
11P_Bad1


Last updated: August 06, 2026