Class LIMEColumnar
java.lang.Object
org.tribuo.classification.explanations.lime.LIMEBase
org.tribuo.classification.explanations.lime.LIMEColumnar
- All Implemented Interfaces:
ColumnarExplainer<Regressor>
,TabularExplainer<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.
See:
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.
-
Field Summary
Fields inherited from class org.tribuo.classification.explanations.lime.LIMEBase
DISTANCE_DELTA, evaluator, explanationTrainer, innerModel, kernelWidth, numSamples, numTrainingExamples, regressionFactory, rng, WIDTH_CONSTANT
-
Constructor Summary
ConstructorDescriptionLIMEColumnar
(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. -
Method Summary
Modifier and TypeMethodDescriptionExplains the supplied data.protected com.oracle.labs.mlrg.olcut.util.Pair<LIMEExplanation,
List<Example<Regressor>>> explainWithSamples
(Map<String, String> input) protected String
nameFeature
(String fieldName, String name, int idx) Generate the feature name by combining the word and index.Methods inherited from class org.tribuo.classification.explanations.lime.LIMEBase
explain, explainWithSamples, kernelDist, measureDistance, samplePoint, trainExplainer, transformOutput
-
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.- Parameters:
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
- TheRowProcessor
which converts columnar data into anExample
.tokenizer
- The tokenizer to use on any text fields.
-
-
Method Details
-
explain
Description copied from interface:ColumnarExplainer
Explains the supplied data. The Map is first converted into anExample
using aRowProcessor
, before being supplied to the internalModel
.- Specified by:
explain
in interfaceColumnarExplainer<Regressor>
- Parameters:
input
- The data to explain.- Returns:
- An Explanation for this data.
-
explainWithSamples
-
nameFeature
Generate the feature name by combining the word and index.- Parameters:
fieldName
- The name of the column this text feature came from.name
- The word.idx
- The index.- Returns:
- A string representing both of the inputs.
-