trustyai.model.simple_prediction

trustyai.model.simple_prediction(input_features: int | float | integer | inexact | ndarray | DataFrame | Series | List[Feature] | PredictionInput, outputs: int | float | integer | inexact | ndarray | DataFrame | Series | List[Output] | PredictionOutput, feature_names: List[str] | None = None, output_names: List[str] | None = None) SimplePrediction

Wrap features and outputs into a SimplePrediction. Given a list of features and outputs, this function will bundle them into Prediction objects for use with the LIME and SHAP explainers.

Parameters:
input_featuresint, float, numpy.number, List[Union[int, float, numpy.number]], numpy.ndarray, pandas.DataFrame, pandas.Series, List[Feature], or PredictionInput

List of input features, as a:

  • If there’s only a single input feature, an int, float, or any of the Numpy equivalents can be used.

  • A list of int, float, or any of the Numpy equivalents.

  • Numpy array of shape [1, n_features] or [n_features]

  • Pandas DataFrame with 1 row and n_features columns

  • Pandas Series with n_features rows

  • A List of TrustyAI Feature, as created by the feature() function

  • A TrustyAI PredictionInput

outputsint, float, numpy.number, List[Union[int, float, numpy.number]], numpy.ndarray, pandas.DataFrame, pandas.Series, List[Output], or PredictionOutput

The desired model outputs to be searched for in the counterfactual explanation. These can take the form of a:

  • If there’s only a single output, an int, float, or any of the Numpy equivalents can be used.

  • A list of int, float, or any of the Numpy equivalents.

  • Numpy array of shape [1, n_outputs] or [n_outputs]

  • Pandas DataFrame with 1 row and n_outputs columns

  • Pandas Series with n_outputs rows

  • A List of TrustyAI Output, as created by the output() function

  • A TrustyAI PredictionOutput

feature_names: Optional[List[str]]

The names of the features, in the case where the feature object does not contain them

output_names: Optional[List[str]]

The names of the outputs, in the case where the outputobject does not contain them