# API Reference

Documentation for the interpretableai package

## Data Preparation

MixedDataType
MixedData(values, ordinal_levels=None)

Represents a mixed data feature

MixedData features can represent a feature with either numeric/categoric or ordinal/categoric values.

Parameters

• values: (list-like) The values of the mixed feature. In a numeric/categoric mix, all numeric elements will be treated as numeric and all remaining elements as categoric. In an ordinal/categoric mix, all elements belonging to the ordinal_levels will be treated as ordinal, and all remaining elements as categoric.
• ordinal_levels: (Index-like, optional) If not supplied, the feature is treated as a numeric/categoric mix. If supplied, these are the ordered levels of the ordinal values in the ordinal/categoric mix.
split_dataFunction
split_data(task, X, *y, **kwargs)

Split the data (X and y) into a tuple of training and testing data, (X_train, y_train), (X_test, y_test), for a problem of type task.

Julia Equivalent: IAI.split_data

## Learners

### Learner

fitMethod
lnr.fit(X, *y, sample_weight=None)

Fit a model using the parameters in learner and the data X and y.

Julia Equivalent: IAI.fit!

Parameters

Refer to the documentation on data preparation for information on how to format and supply the data.

### SurvivalLearner

predict_hazardMethod
lnr.predict_hazard(X)

Return the fitted hazard coefficient estimate made by the learner for each point in the data X.

A higher hazard coefficient estimate corresponds to a smaller predicted survival time.

Julia Equivalent: IAI.predict_hazard

IAI Compatibility

Requires IAI version 1.2 or higher.

### PolicyLearner

predict_outcomesMethod
lnr.predict_outcomes(X, rewards)

Return the outcome from rewards for point in the features X under the prescriptions made by the learner.

Julia Equivalent: IAI.predict_outcomes

IAI Compatibility

Requires IAI version 2.0 or higher.

### ImputationLearner

ImputationLearnerType
ImputationLearner(method='opt_knn', **kwargs)

Abstract type containing all imputation learners.

Julia Equivalent: IAI.ImputationLearner

Parameters

Can be used to construct instances of imputation learners using the method keyword argument.

Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.

### RewardEstimationLearner

fit_predictMethod
lnr.fit_predict(X, treatments, outcomes)

Fit a reward estimation model on features X, treatments treatments, and outcomes outcomes, and return predicted counterfactual rewards for each observation.

Julia Equivalent: IAI.fit_predict!

IAI Compatibility

Requires IAI version 2.0 or higher.

## GridSearch

fit_cvMethod
grid.fit_cv(X, *y, **kwargs)

Fit a grid with data X and y using k-fold cross-validation.

Julia Equivalent: IAI.fit_cv!

Parameters

Refer to the documentation on data preparation for information on how to format and supply the data.

fit_transform_cvMethod
grid.fit_transform_cv(X, **kwargs)

For imputation learners, fit a grid with features X using k-fold cross-validation and impute missing values in X.

Julia Equivalent: IAI.fit_transform_cv!

Parameters

Refer to the documentation on data preparation for information on how to format and supply the data.

## Tree Learners

### TreeLearner

decision_pathMethod
lnr.decision_path(X)

Return a matrix where entry (i, j) is True if the ith point in the features X passes through the jth node in the learner.

Julia Equivalent: IAI.decision_path

### ClassificationTreeLearner

set_thresholdMethod
lnr.set_threshold(label, threshold, simplify=False)

For a binary classification problem, update the the predicted labels in the leaves of the learner to predict label only if the predicted probability is at least threshold. If simplify is True, the tree will be simplified after all changes have been made.

Julia Equivalent: IAI.set_threshold!

## Optimal Trees

OptimalTreePolicyMinimizerType
OptimalTreePolicyMinimizer(**kwargs)

Learner for training Optimal Policy Trees where the policy should aim to minimize outcomes.

Julia Equivalent: IAI.OptimalTreePolicyMinimizer

Parameters

Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.

IAI Compatibility

Requires IAI version 2.0 or higher.

OptimalTreePolicyMaximizerType
OptimalTreePolicyMaximizer(**kwargs)

Learner for training Optimal Policy Trees where the policy should aim to maximize outcomes.

Julia Equivalent: IAI.OptimalTreePolicyMaximizer

Parameters

Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.

IAI Compatibility

Requires IAI version 2.0 or higher.

## OptImpute

imputeFunction
impute(X, *args, **kwargs)

Impute the missing values in X using either a specified method or through grid search validation.

Julia Equivalent: IAI.impute

Parameters

Refer to the Julia documentation for available parameters.

impute_cvFunction
impute_cv(X, *args, **kwargs)

Impute the missing values in X using cross validation.

Julia Equivalent: IAI.impute_cv

Parameters

Refer to the Julia documentation for available parameters.

## Reward Estimation

RewardEstimatorType
RewardEstimator(**kwargs)

Learner for conducting Reward Estimation.

Julia Equivalent: IAI.RewardEstimator

Parameters

Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.

IAI Compatibility

Requires IAI version 2.0 or higher.

## Miscellaneous Types

### ROCCurve

ROCCurveType

Container for ROC curve information with the following fields:

• coords: a dict for each point on the curve with the following keys:
• 'fpr': false positive rate at the given threshold
• 'tpr': true positive rate at the given threshold
• 'threshold': the threshold
• auc: the area-under-the-curve (AUC)

Julia Equivalent: IAI.ROCCurve

ROCCurve(lnr, X, y)

Construct an ROCCurve using trained lnr on the features X and labels y.

ROCCurve(probs, y, positive_label=positive_label)

Construct an ROCCurve using predicted probabilities probs and true labels y, with probabilities indicating chance of predicting positive_label.

### SurvivalCurve

get_dataMethod
curve.get_data()

Extract the underlying data from the curve as a dict with two keys:

• 'times': the time for each breakpoint on the curve
• 'coefs': the probablility for each breakpoint on the curve

Julia Equivalent: IAI.get_survival_curve_data