Trying to run a kaggle notebook


I'm found an interesting problem on kaggle and more or less solved it with my limited knowledge of machine learning. I was curious how other people solved and checked the solution with the highest vote.

The solution includes a line where is implementing and training a model.

params = {'num_leaves': 8,
         'min_data_in_leaf': 42,
         'objective': 'binary',
         'max_depth': 5,
         'learning_rate': 0.01,
         'boosting': 'gbdt',
         'bagging_freq': 5,
         'feature_fraction': 0.8201,
         'bagging_seed': 11,
         'reg_alpha': 1,
         'reg_lambda': 4,
         'random_state': 42,
         'metric': 'auc',
         'verbosity': -1,
         'subsample': 0.81,
         'num_threads': 4}
oof_lgb, scores = train_model(X, y, params=params, folds=folds, model_type='lgb', plot_feature_importance=True)

But it is nowhere mentioned what kind of model he is using, which causes the error.

NameError: name 'train_model' is not defined

Does someone of you know which model he is using, so that i can run his notebook on my computer.


Posted 2021-01-12T13:12:18.903

Reputation: 5



The actual code is included in the notebook, if you click on the 'Code' button just above the cell with the code you provide you will see the code used to define the train_model function. If you look in that function you will see that this function can use different models based on the model_type argument, and in the line of code you linked 'lgb' means that a gradient boosting model from the lgb library is used.


Posted 2021-01-12T13:12:18.903

Reputation: 1 404

Ahh i see. Thx a lot. – tester931 – 2021-01-12T13:42:11.000