Class LIMEColumnar

All Implemented Interfaces:
ColumnarExplainer<Regressor>, TabularExplainer<Regressor>

public class LIMEColumnar extends LIMEBase implements ColumnarExplainer<Regressor>
Uses the columnar data processing infrastructure to mix text and tabular data.

If the supplied RowProcessor doesn't reference any text or binarised fields then it delegates to LIMEBase.explain(org.tribuo.Example<org.tribuo.classification.Label>), though it's still more expensive at construction time.


 Ribeiro MT, Singh S, Guestrin C.
 "Why should I trust you?: Explaining the predictions of any classifier"
 Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining 2016.
  • Constructor Details

    • LIMEColumnar

      public LIMEColumnar(SplittableRandom rng, Model<Label> innerModel, SparseTrainer<Regressor> explanationTrainer, int numSamples, RowProcessor<Label> exampleGenerator, Tokenizer tokenizer)
      Constructs a LIME explainer for a model which uses the columnar data processing system.
      rng - The rng to use for sampling.
      innerModel - The model to explain.
      explanationTrainer - The trainer for the sparse model used to explain.
      numSamples - The number of samples to generate in each explanation.
      exampleGenerator - The RowProcessor which converts columnar data into an Example.
      tokenizer - The tokenizer to use on any text fields.
  • Method Details

    • explain

      public LIMEExplanation explain(Map<String,String> input)
      Description copied from interface: ColumnarExplainer
      Explains the supplied data. The Map is first converted into an Example using a RowProcessor, before being supplied to the internal Model.
      Specified by:
      explain in interface ColumnarExplainer<Regressor>
      input - The data to explain.
      An Explanation for this data.
    • explainWithSamples

      protected<LIMEExplanation,List<Example<Regressor>>> explainWithSamples(Map<String,String> input)
    • nameFeature

      protected String nameFeature(String fieldName, String name, int idx)
      Generate the feature name by combining the word and index.
      fieldName - The name of the column this text feature came from.
      name - The word.
      idx - The index.
      A string representing both of the inputs.