Gradient Boosting Decision Tree (GBDT) adalah algoritma pembelajaran mesin canggih yang menggunakan pendekatan iteratif untuk membangun kumpulan pohon keputusan dalam analisis regresi. Dengan mengoptimalkan fungsi loss secara progresif, algoritma ini efektif menangani masalah regresi linier dan nonlinier serta memberikan hasil prediksi yang sangat akurat.
Konfigurasikan komponen
Anda dapat menggunakan salah satu metode berikut untuk mengonfigurasi komponen Regresi GBDT:
Metode 1: Konfigurasikan komponen pada halaman pipeline
Anda dapat mengonfigurasi parameter komponen Regresi GBDT pada halaman pipeline Machine Learning Designer dari Platform for AI (PAI). Machine Learning Designer sebelumnya dikenal sebagai Machine Learning Studio. Tabel berikut menjelaskan parameter-parameter tersebut:
Tab | Parameter | Deskripsi |
Fields Setting | Input Columns | Kolom fitur yang dipilih dari tabel input untuk pelatihan. Kolom tipe DOUBLE dan BIGINT didukung. null Maksimal 800 kolom fitur dapat dipilih. |
Label Column | Kolom label. Kolom tipe DOUBLE dan BIGINT didukung. | |
Group Column | Kolom tipe DOUBLE dan BIGINT didukung. Secara default, seluruh tabel adalah satu grup. | |
Parameters Setting | Loss Function Type | Tipe fungsi loss. Nilai valid: Gbrank Loss, Lambdamart DCG Loss, Lambdamart NDCG Loss, dan Regression Loss. |
Tau in gbrank loss | Parameter ini hanya diperlukan jika parameter Tipe Fungsi Loss diatur ke Gbrank Loss. Nilai valid: [0,1]. | |
Exponent Base of Gbrank and Regression Loss | Parameter ini hanya diperlukan jika parameter Tipe Fungsi Loss diatur ke Gbrank Loss atau Regression Loss. Nilai valid: [1,10]. | |
Metric Type | Tipe metrik. Nilai valid: NDCG dan DCG. | |
Number of Decision Trees | Jumlah pohon. Nilai valid: 1 hingga 10000. | |
Learning Rate | Tingkat pembelajaran. Nilai valid: (0,1). | |
Maximum Leaf Quantity | Jumlah maksimum node daun pada setiap pohon. Nilai valid: 1 hingga 1000. | |
Maximum Decision Tree Depth | Kedalaman maksimum setiap pohon. Nilai valid: 1 hingga 11. | |
Minimum Sample Quantity on a Leaf Node | Jumlah minimum sampel pada setiap node daun. Nilai valid: 1 hingga 1000. | |
Sample Ratio | Proporsi sampel yang dipilih untuk pelatihan. Nilai valid: (0,1). | |
Feature Ratio | Proporsi fitur yang dipilih untuk pelatihan. Nilai valid: (0,1). | |
Sample Ratio | Proporsi sampel yang dipilih untuk pengujian. Nilai valid: [0,1). | |
Random Seed | Seed acak. Nilai valid: [0,10]. | |
Use Newton-Raphson Method | Menentukan apakah akan menggunakan metode Newton. | |
Maximum Feature Split Times | Jumlah maksimum pemisahan setiap fitur. Nilai valid: 1 hingga 1000. | |
Tuning | Number of Computing Cores | Jumlah core. Sistem secara otomatis mengalokasikan core berdasarkan volume data input. |
Memory Size per Core | Ukuran memori setiap core. Sistem secara otomatis mengalokasikan memori berdasarkan volume data input. Satuan: MB. |
Metode 2: Gunakan perintah PAI
Konfigurasikan parameter komponen dengan menggunakan perintah PAI. Anda dapat menggunakan komponen SQL Script untuk memanggil perintah PAI. Untuk informasi lebih lanjut, lihat SQL Script.
PAI -name gbdt
-project algo_public
-DfeatureSplitValueMaxSize="500"
-DlossType="0"
-DrandSeed="0"
-DnewtonStep="0"
-Dshrinkage="0.05"
-DmaxLeafCount="32"
-DlabelColName="campaign"
-DinputTableName="bank_data_partition"
-DminLeafSampleCount="500"
-DsampleRatio="0.6"
-DgroupIDColName="age"
-DmaxDepth="11"
-DmodelName="xlab_m_GBDT_83602"
-DmetricType="2"
-DfeatureRatio="0.6"
-DinputTablePartitions="pt=20150501"
-Dtau="0.6"
-Dp="1"
-DtestRatio="0.0"
-DfeatureColNames="previous,cons_conf_idx,euribor3m"
-DtreeCount="500"Parameter | Diperlukan | Deskripsi | Nilai default |
inputTableName | Ya | Nama tabel input. | N/A |
featureColNames | Tidak | Kolom fitur yang dipilih dari tabel input untuk pelatihan. Kolom tipe DOUBLE dan BIGINT didukung. | Semua kolom tipe data numerik |
labelColName | Ya | Kolom label dalam tabel input. Kolom tipe DOUBLE dan BIGINT didukung. | N/A |
inputTablePartitions | Tidak | Partisi yang dipilih dari tabel input untuk pelatihan. Tentukan parameter ini dalam salah satu format berikut:
null Jika Anda menentukan beberapa partisi, pisahkan partisi-partisi tersebut dengan koma (,). | Semua partisi |
modelName | Ya | Nama model output. | N/A |
outputImportanceTableName | Tidak | Nama tabel yang menyediakan pentingnya fitur. | N/A |
groupIDColName | Tidak | Nama kolom grup. | Seluruh tabel |
lossType | Tidak | Tipe fungsi loss. Nilai valid:
| 0 |
metricType | Tidak | Tipe metrik. Nilai valid:
| 0 |
treeCount | Tidak | Jumlah pohon. Nilai valid: 1 hingga 10000. | 500 |
shrinkage | Tidak | Tingkat pembelajaran. Nilai valid: (0,1). | 0.05 |
maxLeafCount | Tidak | Jumlah maksimum node daun pada setiap pohon. Nilai valid: 1 hingga 1000. | 32 |
maxDepth | Tidak | Kedalaman maksimum setiap pohon. Nilai valid: 1 hingga 11. | 10 |
minLeafSampleCount | Tidak | Jumlah minimum sampel pada setiap node daun. Nilai valid: 1 hingga 1000. | 500 |
sampleRatio | Tidak | Proporsi sampel yang dipilih untuk pelatihan. Nilai valid: (0,1). | 0.6 |
featureRatio | Tidak | Proporsi fitur yang dipilih untuk pelatihan. Nilai valid: (0,1). | 0.6 |
tau | Tidak | Parameter Tau untuk fungsi loss GBRank. Nilai valid: [0,1]. | 0.6 |
p | Tidak | Parameter p untuk fungsi loss GBRank. Nilai valid: [1,10]. | 1 |
randSeed | Tidak | Seed acak. Nilai valid: [0,10]. | 0 |
newtonStep | Tidak | Menentukan apakah akan menggunakan metode Newton. Nilai valid: 0 dan 1. | 1 |
featureSplitValueMaxSize | Tidak | Jumlah maksimum pemisahan setiap fitur. Nilai valid: 1 hingga 1000. | 500 |
lifecycle | Tidak | Siklus hidup tabel output. | N/A |
Contoh
Jalankan pernyataan SQL berikut untuk menghasilkan data uji:
drop table if exists gbdt_ls_test_input; create table gbdt_ls_test_input as select * from ( select cast(1 as double) as f0, cast(0 as double) as f1, cast(0 as double) as f2, cast(0 as double) as f3, cast(0 as bigint) as label union all select cast(0 as double) as f0, cast(1 as double) as f1, cast(0 as double) as f2, cast(0 as double) as f3, cast(0 as bigint) as label union all select cast(0 as double) as f0, cast(0 as double) as f1, cast(1 as double) as f2, cast(0 as double) as f3, cast(1 as bigint) as label union all select cast(0 as double) as f0, cast(0 as double) as f1, cast(0 as double) as f2, cast(1 as double) as f3, cast(1 as bigint) as label union all select cast(1 as double) as f0, cast(0 as double) as f1, cast(0 as double) as f2, cast(0 as double) as f3, cast(0 as bigint) as label union all select cast(0 as double) as f0, cast(1 as double) as f1, cast(0 as double) as f2, cast(0 as double) as f3, cast(0 as bigint) as label ) a;Tabel data uji berikut gbdt_ls_test_input dihasilkan:
f0
f1
f2
f3
label
1.0
0.0
0.0
0.0
0
0.0
0.0
1.0
0.0
1
0.0
0.0
0.0
1.0
1
0.0
1.0
0.0
0.0
0
1.0
0.0
0.0
0.0
0
0.0
1.0
0.0
0.0
0
Jalankan perintah PAI berikut untuk menyerahkan parameter pelatihan yang dikonfigurasi untuk komponen Regresi GBDT:
drop offlinemodel if exists gbdt_ls_test_model; PAI -name gbdt -project algo_public -DfeatureSplitValueMaxSize="500" -DlossType="3" -DrandSeed="0" -DnewtonStep="1" -Dshrinkage="0.5" -DmaxLeafCount="32" -DlabelColName="label" -DinputTableName="gbdt_ls_test_input" -DminLeafSampleCount="1" -DsampleRatio="1" -DmaxDepth="10" -DmetricType="0" -DmodelName="gbdt_ls_test_model" -DfeatureRatio="1" -Dp="1" -Dtau="0.6" -DtestRatio="0" -DfeatureColNames="f0,f1,f2,f3" -DtreeCount="10"Jalankan perintah PAI berikut untuk menyerahkan parameter yang dikonfigurasi untuk komponen Prediksi:
drop table if exists gbdt_ls_test_prediction_result; PAI -name prediction -project algo_public -DdetailColName="prediction_detail" -DmodelName="gbdt_ls_test_model" -DitemDelimiter="," -DresultColName="prediction_result" -Dlifecycle="28" -DoutputTableName="gbdt_ls_test_prediction_result" -DscoreColName="prediction_score" -DkvDelimiter=":" -DinputTableName="gbdt_ls_test_input" -DenableSparse="false" -DappendColNames="label"Lihat tabel hasil prediksi gbdt_ls_test_prediction_result:
label
prediction_result
prediction_score
prediction_detail
0
NULL
0.0
{"label": 0}
0
NULL
0.0
{"label": 0}
1
NULL
0.9990234375
{"label": 0.9990234375}
1
NULL
0.9990234375
{"label": 0.9990234375}
0
NULL
0.0
{"label": 0}
0
NULL
0.0
{"label": 0}