Home > other >  Rookie help: the Xgboost results into SQL statements
Rookie help: the Xgboost results into SQL statements

Time:09-21

Everyone a great god, and I have a question below:

By a simple Xgboost model, with the following statement can export model tree results:

BST. Dump_model (" E: \ Python \ model. TXT ")

Results similar to the following:

Booster [0] :
0: [2.45000005] f2 & lt; yes=1, no=2, missing=1
1: the leaf=0.021014493
2: the leaf=0.0205882359
Booster [1] :
0: [2.3499999] f2 & lt; yes=1, no=2, missing=1
1: the leaf=0.0190295223
2: the leaf=0.021607263
Booster [2] :
0: [2.45000005] f2 & lt; yes=1, no=2, missing=1
1: the leaf=0.020597266
2: the leaf=0.0209805444
Booster [3] :
0: [f3 & lt; 0.75] yes=1, no=2, missing=1
1: the leaf=0.0203853883
2: the leaf=0.0199462976

I want to convert the above results to SQL, similar to the following:
The Case when f2 & lt; 2.45000005 then 0.021014493 else 0.0205882359 end as a1,
The Case when f2 & lt; 2.3499999 then 0.0190295223 else 0.021607263 end as a2...

How do I achieve? Thank you very much!
  • Related