001/*
002 * Copyright (c) 2015-2020, Oracle and/or its affiliates. All rights reserved.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.tribuo.classification.explanations;
018
019import org.tribuo.Model;
020import org.tribuo.Output;
021import org.tribuo.Prediction;
022import org.tribuo.classification.Label;
023
024import java.io.Serializable;
025import java.util.List;
026
027/**
028 * An explanation knows what features are used, what the explaining Model is and what the original Model's prediction is.
029 */
030public interface Explanation<T extends Output<T>> extends Serializable {
031
032    /**
033     * Returns the names of the active features in this explanation.
034     * @return The active feature names.
035     */
036    public List<String> getActiveFeatures();
037
038    /**
039     * Returns the explanining model.
040     * @return The explanation model.
041     */
042    public Model<T> getModel();
043
044    /**
045     * The original model's prediction which is being explained.
046     * @return The original prediction.
047     */
048    public Prediction<Label> getPrediction();
049
050}