0
$\begingroup$

I implemented Gridsearch for a LightGBM, predicting a binary outcome with 33 features.

pipe = Pipeline(steps=[
                   ('standardscaler', MinMaxScaler()),                       
                   ('lgb',lgb.LGBMClassifier(verbose=-1))
                   
                  ]
           )
param_distributions = {
                   # specify here the number of features you want to test using the RFE method
                   #'feat_sel__n_features_to_select': [10,13] ,
                   # ... other parameters you want to search ...                     
                  "lgb__scale_pos_weight":[1.85],
                  "lgb__max_depth": [6],
                  "lgb__num_estimators": [100,200],
                  "lgb__learning_rate": [0.16,0.1,0.2],
                  "lgb__num_leaves" :[31],                                       
                  "lgb__objective":['binary'],                                            
                  "lgb__min_child_samples":[25,30,35],
                  "lgb__min_split_gain":[0.8,0.7,0.6],
                  "lgb__min_child_weight":[0.1,0.2,0.3],                      
                  "lgb__reg_alpha": [7,6,5],
                  "lgb__reg_lambda": [8,7,6],
                  "lgb__subsample":[0.7,0.8,0.9],
                  "lgb__subsample_freq":[5,4,3],
                  "lgb__colsample_bytree":[0.7,0.5,0.6],                                           
                  "lgb__importance_type" :['gain'],   
                  }# Set up score

  kfold = StratifiedKFold(n_splits=5, shuffle=True, random_state=42) 
  lg = GridSearchCV(estimator=pipe,
                        param_grid=param_distributions,
                        cv=kfold, 
                        scoring ='f1',
                        refit=True, 
                        n_jobs=-1, 
                        verbose=1,                           
                       return_train_score=True)

                   
  np.random.seed(1234)
  grid_result=lg.fit(X_train, y_train)
  print(f'The best hyperparameters are {grid_result.best_params_}')
  lg_opt = lg.best_estimator_

How could I plot a binary log loss metric for this model after using Gridserach?

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.