lightgbm

"lightgbm"

Posted by zwt on August 15, 2022

配置

1
2
config('spark.jars.packages', "com.microsoft.ml.spark:mmlspark_2.11:0.18.1")
.config('spark.jars', "./notebook/jar/lightgbmlib-2.2.350.jar")

使用

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from mmlspark.lightgbm import LightGBMClassifier
lgb = LightGBMClassifier(
    objective="binary",
    boostingType='gbdt',
    isUnbalance=True,
    featuresCol='features',
    labelCol='label',
    maxBin=60,
    baggingFreq=1,
    baggingSeed=696,
    earlyStoppingRound=30,
    learningRate=0.1,
    lambdaL1=1.0,
    lambdaL2=45.0,
    maxDepth=3,
    numLeaves=128,
    baggingFraction=0.7,
    featureFraction=0.7,
    # minSumHessianInLeaf=1,
    numIterations=100,
    verbosity=50
)