Explaining Predictions

Explain Endpoint

Valid for Image, Classification, and MultiLabel collections.

Predict the most likely class or set of labels for a new document, and additionally return
the training examples that are most similar to your new document.

collection.explain('text')
{
    'class_confidence': {'label-1': 0.0145, 'label-2': 0.9855},
    'confidence': 0.9855,
    'explanation': [
        {'data': 'text', 'metadata': {}, 'prediction': ['label-2'], 'similarity': 0.6942, 'target': ['label-2']},
        {'data': 'text', 'metadata': {}, 'prediction': ['label-2'], 'similarity': 0.6881, 'target': ['label-2']},
        {'data': 'text', 'metadata': {}, 'prediction': ['label-2'], 'similarity': 0.6859, 'target': ['label-2']}
    ], 
    'prediction': 'label-2'
}

 

Vizualizing Explanations

Visualize how much each source term contributed to a trained collection’s prediction.

from indicoio.custom import Collection, visualize_explanation

collection = Collection('influenza')

text = "Host factors of influenza virus replication are often found in key topological positions within protein-protein interaction networks. This work explores how protein states can be manipulated through controllability analysis: the determination of the minimum manipulation needed to drive the cell system to any desired state. Here, we complete a two-part controllability analysis of two protein networks: a host network representing the healthy cell state and an influenza..."

explanation = collection.explain(text, sequence_features=True)

visualize_explanation(explanation)

Explain Visualization