code: def explain_weights_lightgbm(
      lgb,
      vec=None,
      top=20,
      target_names=None,  # ignored
      targets=None,  # ignored
      feature_names=None,
      feature_re=None,
      feature_filter=None,
      importance_type="gain",
  ):
      """
      Return an explanation of an LightGBM estimator (via scikit-learn wrapper
      LGBMClassifier or LGBMRegressor) as feature importances.
  
      See :func:`eli5.explain_weights` for description of
      ``top``, ``feature_names``,
      ``feature_re`` and ``feature_filter`` parameters.
  
      ``target_names`` and ``targets`` parameters are ignored.
  
      Parameters
      ----------
      importance_type : str, optional
          A way to get feature importance. Possible values are:
  
          - 'gain' - the average gain of the feature when it is used in trees
            (default)
          - 'split' - the number of times a feature is used to split the data
            across all trees
          - 'weight' - the same as 'split', for compatibility with xgboost
      """
      coef = _get_lgb_feature_importances(lgb, importance_type)
      lgb_feature_names = lgb.booster_.feature_name()
      return get_feature_importance_explanation(
          lgb,
          vec,
          coef,
          feature_names=feature_names,
          estimator_feature_names=lgb_feature_names,
          feature_filter=feature_filter,
          feature_re=feature_re,
          top=top,
          description=DESCRIPTION_LIGHTGBM,
          num_features=coef.shape[-1],
          is_regression=isinstance(lgb, lightgbm.LGBMRegressor),
      )
  
file_path: eli5/eli5/lightgbm.py
imports: from __future__ import absolute_import, division
  from collections import defaultdict
  from typing import DefaultDict, Optional
  import numpy
  import lightgbm
  from eli5.explain import explain_weights, explain_prediction
  from eli5._feature_importances import get_feature_importance_explanation
  from eli5.sklearn.utils import handle_vec, get_X, get_X0, add_intercept, predict_proba
  from eli5._decision_path import get_decision_path_explanation
label_desc: Use image node_id 1 for calling a global function with example usage: explain_weights_lightgbm(lgb, vec, top, target_names, targets, feature_names, feature_re, feature_filter, importance_type) and returns: get_feature_importance_explanation