I am trying to build a lightgbm classifier model using pipeline to do both vectorassembler and classifier model. Throws me an AttributeError: ‘PipelineModel’ object has no attribute ‘getStages’
Can someone explain what I am doing wrong and whats the workaround, please!
vec_assembler = VectorAssembler(inputCols=feature_names, outputCol='features', handleInvalid='keep')
clf = LightGBMClassifier(objective = "binary", numIterations = 131, labelCol = label_name, featureFraction=0.7359426186756919, featuresCol = vec_assembler.getOutputCol(), lambdaL1= 2.6412440976672578,
lambdaL2=3.6431353203238968,
learningRate=0.15246427666174822,
maxBin=357,
maxDepth=12,
minDataInLeaf=222,
numLeaves=129,
baggingFraction=0.6183795579454406,
seed=SEED)
pipeline = Pipeline(stages=[vec_assembler,clf]) #SITE ID
model = pipeline.fit(train)
from xgboost import plot_importance
import matplotlib.pyplot as plt
plt.rcParams["figure.figsize"] = (8, 24)
booster = model.getStages()[-1].get_booster()
booster.feature_names = col_names
plot_importance(booster)`AttributeError: 'PipelineModel' object has no attribute 'getStages'`
New contributor
aisvi182 Sharma is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.