API Reference
Documentation for the interpretableai package
Index
AbstractVisualizationCategoricalClassificationRewardEstimatorCategoricalRegressionRewardEstimatorCategoricalRewardEstimationLearnerCategoricalSurvivalRewardEstimatorClassificationLearnerClassificationMultiLearnerClassificationTreeLearnerClassificationTreeMultiLearnerEqualPropensityEstimatorGLMNetCVClassifierGLMNetCVLearnerGLMNetCVRegressorGLMNetCVSurvivalLearnerGLMNetLearnerGridSearchImputationLearnerLearnerMeanImputationLearnerMixedDataMultiLearnerMultiQuestionnaireMultiQuestionnaireMultiTreePlotMultiTreePlotNumericClassificationRewardEstimatorNumericRegressionRewardEstimatorNumericRewardEstimationLearnerNumericSurvivalRewardEstimatorOptKNNImputationLearnerOptSVMImputationLearnerOptTreeImputationLearnerOptimalFeatureSelectionClassifierOptimalFeatureSelectionLearnerOptimalFeatureSelectionRegressorOptimalTreeClassifierOptimalTreeLearnerOptimalTreeMultiClassifierOptimalTreeMultiLearnerOptimalTreeMultiRegressorOptimalTreePolicyMaximizerOptimalTreePolicyMinimizerOptimalTreePrescriptionMaximizerOptimalTreePrescriptionMinimizerOptimalTreeRegressorOptimalTreeSurvivalLearnerPolicyLearnerPolicyTreeLearnerPrescriptionLearnerPrescriptionTreeLearnerQuestionnaireQuestionnaireQuestionnaireROCCurveROCCurveROCCurveROCCurveRandImputationLearnerRandomForestClassifierRandomForestLearnerRandomForestRegressorRandomForestSurvivalLearnerRegressionLearnerRegressionMultiLearnerRegressionTreeLearnerRegressionTreeMultiLearnerRewardEstimationLearnerSimilarityComparisonSingleKNNImputationLearnerStabilityAnalysisSupervisedLearnerSupervisedMultiLearnerSurvivalCurveSurvivalLearnerSurvivalTreeLearnerTreeLearnerTreeMultiLearnerTreePlotTreePlotUnsupervisedLearnerXGBoostClassifierXGBoostLearnerXGBoostRegressorXGBoostSurvivalLearnerZeroImputationLearneracquire_licenseadd_julia_processesall_treatment_combinationsapplyapply_nodescleanup_installationcloneconvert_treatments_to_numericcopy_splits_and_refit_leavesdecision_pathdelete_rich_output_paramfitfitfitfitfit_and_expandfit_cvfit_predictfit_predictfit_predictfit_transformfit_transform_cvget_best_paramsget_classification_labelget_classification_labelget_classification_probaget_classification_probaget_cluster_assignmentsget_cluster_detailsget_cluster_distancesget_dataget_dataget_depthget_estimation_densitiesget_features_usedget_grid_result_detailsget_grid_result_summaryget_learnerget_lower_childget_machine_idget_num_fitsget_num_fitsget_num_nodesget_num_samplesget_paramsget_parentget_policy_treatment_outcomeget_policy_treatment_outcome_standard_errorget_policy_treatment_rankget_prediction_constantget_prediction_constantget_prediction_weightsget_prediction_weightsget_prescription_treatment_rankget_regression_constantget_regression_constantget_regression_constantget_regression_constantget_regression_constantget_regression_constantget_regression_weightsget_regression_weightsget_regression_weightsget_regression_weightsget_regression_weightsget_regression_weightsget_rich_output_paramsget_split_categoriesget_split_featureget_split_thresholdget_split_weightsget_stability_resultsget_survival_curveget_survival_expected_timeget_survival_hazardget_train_errorsget_treeget_upper_childimputeimpute_cvinstallinstall_juliainstall_system_imageis_categoric_splitis_hyperplane_splitis_leafis_mixed_ordinal_splitis_mixed_parallel_splitis_ordinal_splitis_parallel_splitload_graphvizmissing_goes_lowerplotplotplotplotpredictpredictpredictpredictpredictpredictpredictpredict_expected_survival_timepredict_expected_survival_timepredict_expected_survival_timepredict_hazardpredict_hazardpredict_outcomespredict_outcomespredict_probapredict_probapredict_probapredict_rewardpredict_rewardpredict_shappredict_treatment_outcomepredict_treatment_outcome_standard_errorpredict_treatment_rankprint_pathprune_treesread_jsonrefit_leavesrelease_licensereset_display_labelresume_from_checkpointscorescorescorescorescorescorescoreset_display_labelset_julia_seedset_paramsset_reward_kernel_bandwidthset_rich_output_paramset_thresholdshow_in_browsershow_in_browsershow_in_browsershow_questionnaireshow_questionnairesplit_datatransformtransform_and_expandtune_reward_kernel_bandwidthvariable_importancevariable_importancevariable_importancevariable_importance_similaritywrite_boosterwrite_dotwrite_htmlwrite_htmlwrite_htmlwrite_jsonwrite_pdfwrite_pngwrite_questionnairewrite_questionnairewrite_svg
Setup
install — Function
install(**kwargs)Install Julia packages required for interpretableai.iai.
This function must be called once after the package is installed to configure the connection between Python and Julia.
Parameters
Refer to the installation instructions for information on any additional parameters that may be required.
install_julia — Function
install_julia(**kwargs)Download and install Julia automatically.
Parameters
version: (string, optional) The version of Julia to install (e.g.'1.6.3'). Defaults to'latest', which will install the most recent stable release.prefix: (string, optional) The directory where Julia will be installed. Defaults to a location determined byappdirs.user_data_dir.
install_system_image — Function
install_system_image(**kwargs)Download and install the IAI system image automatically.
Parameters
version: (string, optional) The version of the IAI system image to install (e.g.'2.1.0'). Defaults to'latest', which will install the most recent release.replace_default: (bool) Whether to replace the default Julia system image with the downloaded IAI system image. Defaults toFalse.prefix: (string, optional) The directory where Julia will be installed. Defaults to a location determined byappdirs.user_data_dir.accept_license: (bool) Set toTrueto confirm that you agree to the End User License Agreement and skip the interactive confirmation dialog.
cleanup_installation — Function
cleanup_installation()Remove all files created by install_julia and install_system_image.
get_machine_id — Function
iai.get_machine_id()Return the machine ID for the current computer.
acquire_license — Function
iai.acquire_license()Acquire an IAI license for the current session.
Julia Equivalent: IAI.acquire_license
release_license — Function
iai.release_license()Release any IAI license held by the current session.
Julia Equivalent: IAI.release_license
load_graphviz — Function
iai.load_graphviz()Loads the Julia Graphviz library to permit certain visualizations.
The library will be installed if not already present.
General Utilities
set_julia_seed — Function
add_julia_processes — Function
iai.add_julia_processes(3)Add additional Julia worker processes to parallelize workloads.
Julia Equivalent: Distributed.addprocs
For more information, refer to the documentation on parallelization
read_json — Function
iai.read_json(filename)Read in a learner or grid saved in JSON format from filename.
Julia Equivalent: IAI.read_json
resume_from_checkpoint — Function
iai.resume_from_checkpoint(checkpoint_file)Resume training from the supplied checkpoint_file.
Julia Equivalent: IAI.resume_from_checkpoint
get_rich_output_params — Function
iai.get_rich_output_params()Return the current global rich output parameter settings.
Julia Equivalent: IAI.get_rich_output_params
set_rich_output_param — Function
iai.set_rich_output_param(key, value)Sets the global rich output parameter key to value.
Julia Equivalent: IAI.set_rich_output_param!
delete_rich_output_param — Function
iai.delete_rich_output_param(key)Delete the global rich output parameter key.
Julia Equivalent: IAI.delete_rich_output_param!
Data Preparation
MixedData — Type
iai.MixedData(values, ordinal_levels=None)Represents a mixed data feature
MixedData features can represent a feature with either numeric/categoric or ordinal/categoric values.
Julia Equivalent: IAI.make_mixed_data
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 theordinal_levelswill 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_data — Function
iai.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
Scoring
Learners
Learner
Learner — Type
Abstract type encompassing all learners.
Julia Equivalent: IAI.Learner
fit — Method
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.
set_params — Method
get_params — Method
write_json — Method
lnr.write_json(filename, **kwargs)Write learner or grid to filename in JSON format.
Julia Equivalent: IAI.write_json
variable_importance — Method
lnr.variable_importance()Generate a ranking of the variables in the learner according to their importance during training. The results are normalized so that they sum to one.
Julia Equivalent: IAI.variable_importance
get_features_used — Method
lnr.get_features_used()Return a list of feature names used by the learner.
Julia Equivalent: IAI.get_features_used
SupervisedLearner
SupervisedLearner — Type
Abstract type encompassing all learners for supervised tasks.
Julia Equivalent: IAI.SupervisedLearner
predict — Method
lnr.predict(X)Return the predictions made by the learner for each point in the features X.
Julia Equivalent: IAI.predict
UnsupervisedLearner
UnsupervisedLearner — Type
Abstract type encompassing all learners for unsupervised tasks.
Julia Equivalent: IAI.UnsupervisedLearner
ClassificationLearner
ClassificationLearner — Type
Abstract type encompassing all learners for classification tasks.
Julia Equivalent: IAI.ClassificationLearner
predict_proba — Method
lnr.predict_proba(X)Return the probabilities of class membership predicted by the learner for each point in the features X.
Julia Equivalent: IAI.predict_proba
ROCCurve — Method
lnr.ROCCurve(X, y)Construct an ROCCurve using the trained learner on the features X and labels y
Julia Equivalent: IAI.ROCCurve
RegressionLearner
RegressionLearner — Type
Abstract type encompassing all learners for regression tasks.
Julia Equivalent: IAI.RegressionLearner
SurvivalLearner
SurvivalLearner — Type
Abstract type encompassing all learners for survival tasks.
Julia Equivalent: IAI.SurvivalLearner
predict — Method
Return the predictions made by the learner for each point in the features X (see predict)..
Julia Equivalent: IAI.predict
lnr.predict(X)Return the SurvivalCurve predicted by the trained learner for each point in the data.
lnr.predict(X, t=t)Return the probability that death occurs at or before time t as predicted by the trained learner for each point.
predict_hazard — Method
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
predict_expected_survival_time — Method
lnr.predict_expected_survival_time(X)Return the expected survival time estimate made by the learner for each point in the data X.
Julia Equivalent: IAI.predict_expected_survival_time
PrescriptionLearner
PrescriptionLearner — Type
Abstract type encompassing all learners for prescription tasks.
Julia Equivalent: IAI.PrescriptionLearner
predict_outcomes — Method
lnr.predict_outcomes(X)Return the the predicted outcome for each treatment made by the learner for each point in the features X.
Julia Equivalent: IAI.predict_outcomes
PolicyLearner
PolicyLearner — Type
Abstract type encompassing all learners for policy tasks.
Julia Equivalent: IAI.PolicyLearner
predict_outcomes — Method
lnr.predict_outcomes(X, rewards)Return the outcome from rewards for each point in the features X under the prescriptions made by the learner.
Julia Equivalent: IAI.predict_outcomes
predict_treatment_rank — Method
lnr.predict_treatment_rank(X)Return the treatments in ranked order of effectiveness for each point in the features X as predicted by the learner.
Julia Equivalent: IAI.predict_treatment_rank
predict_treatment_outcome — Method
lnr.predict_treatment_outcome(X)Return the estimated quality of each treatment in the trained model of the learner for each point in the features X.
Julia Equivalent: IAI.predict_treatment_outcome
predict_treatment_outcome_standard_error — Method
lnr.predict_treatment_outcome_standard_error(X)Return the standard error for the estimated quality of each treatment in the trained model of the learner for each point in the features X.
Julia Equivalent: IAI.predict_treatment_outcome_standard_error
ImputationLearner
ImputationLearner — Type
iai.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.
fit_transform — Method
lnr.fit_transform(X, **kwargs)Fit the imputation learner using the training data X and impute the missing values in the training data.
Julia Equivalent: IAI.fit_transform!
Parameters
Refer to the documentation on data preparation for information on how to format and supply the data.
transform — Method
lnr.transform(X)Impute missing values in X using the fitted imputation model in the learner.
Julia Equivalent: IAI.transform
Parameters
Refer to the documentation on data preparation for information on how to format and supply the data.
MultiLearner
MultiLearner — Type
Abstract type encompassing all multi-task learners for supervised tasks.
Julia Equivalent: IAI.MultiLearner
SupervisedMultiLearner
SupervisedMultiLearner — Type
Abstract type encompassing all multi-task learners for supervised tasks.
Julia Equivalent: IAI.SupervisedMultiLearner
predict — Method
Return the predictions made by the learner for each point in the features X.
lnr.predict(X)Return the predictions for all tasks.
Julia Equivalent: IAI.predict
lnr.predict(X, task_label)Return the predictions for a specified task.
Julia Equivalent: IAI.predict
ClassificationMultiLearner
ClassificationMultiLearner — Type
Abstract type encompassing all multi-task learners for classification tasks.
Julia Equivalent: IAI.ClassificationMultiLearner
predict_proba — Method
Return the probabilities of class membership predicted by the learner for each point in the features X.
lnr.predict_proba(X)Return the predictions for all tasks.
Julia Equivalent: IAI.predict_proba
lnr.predict_proba(X, task_label)Return the predictions for a specified task.
Julia Equivalent: IAI.predict_proba
ROCCurve — Method
Construct an ROCCurve using the trained learner on the features X and labels y
lnr.ROCCurve(X)Return the curve for all tasks.
Julia Equivalent: IAI.ROCCurve
lnr.ROCCurve(X, task_label)Return the curve for a specified task.
Julia Equivalent: IAI.ROCCurve
RegressionMultiLearner
RegressionMultiLearner — Type
Abstract type encompassing all multi-task learners for regression tasks.
Julia Equivalent: IAI.RegressionMultiLearner
GridSearch
GridSearch — Type
iai.GridSearch(lnr, params)Controls grid search over parameter combinations in params for lnr.
Julia Equivalent: IAI.GridSearch
fit — Method
grid.fit(X, *y, **kwargs)Fit a grid with 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.
fit_cv — Method
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_cv — Method
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.
get_learner — Method
grid.get_learner()Return the fitted learner using the best parameter combination from the grid.
Julia Equivalent: IAI.get_learner
get_best_params — Method
grid.get_best_params()Return the best parameter combination from the grid.
Julia Equivalent: IAI.get_best_params
get_grid_result_summary — Method
grid.get_grid_result_summary()Return a summary of the results from the grid search.
Julia Equivalent: IAI.get_grid_result_summary
get_grid_result_details — Method
grid.get_grid_result_details()Return a list of dicts detailing the results of the grid search.
Julia Equivalent: IAI.get_grid_result_details
Visualizations
AbstractVisualization — Type
Abstract type encompassing objects related to visualization.
Julia Equivalent: IAI.AbstractVisualization
write_html — Method
treeplot.write_html(filename, **kwargs)Write interactive browser visualization to filename as HTML.
Julia Equivalent: IAI.write_html
show_in_browser — Method
treeplot.show_in_browser(**kwargs)Show interactive visualization in default browser.
Julia Equivalent: IAI.show_in_browser
Questionnaire — Type
Specifies an interactive questionnaire.
Julia Equivalent: IAI.Questionnaire
Parameters
Refer to the Julia documentation on advanced tree visualization for available parameters.
MultiQuestionnaire — Type
Specify an interactive questionnaire of multiple learners
iai.MultiQuestionnaire(questions)Constructs an interactive questionnaire using multiple learners from specified questions. Refer to the documentation on advanced tree visualization for more information.
Julia Equivalent: IAI.MultiQuestionnaire
MultiQuestionnaire — Method
grid.MultiQuestionnaire()Construct a MultiQuestionnaire containing the final fitted learner from the trained grid search as well as the learner found for each parameter combination.
Julia Equivalent: IAI.MultiQuestionnaire
Tree Learners
TreeLearner
TreeLearner — Type
Abstract type encompassing all tree-based learners.
Julia Equivalent: IAI.TreeLearner
apply_nodes — Method
lnr.apply_nodes(X)Return the indices of the points in the features X that fall into each node in the learner.
Julia Equivalent: IAI.apply_nodes
decision_path — Method
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
print_path — Method
lnr.print_path(X)Print the decision path through the learner for each sample in the features X.
Julia Equivalent: IAI.print_path
variable_importance — Method
Calculate the variable importance for the learner (see variable_importance).
Julia Equivalent: IAI.variable_importance
lnr.variable_importance(**kwargs)Calculate the variable_importance for the learner.
lnr.variable_importance(X, **kwargs)Calculate the variable_importance for the learner on new samples X.
lnr.variable_importance(X, *y, **kwargs)Calculate the variable_importance for the learner on new data X and y.
get_num_nodes — Method
lnr.get_num_nodes(node_index)Return the number of nodes in the trained learner.
Julia Equivalent: IAI.get_num_nodes
get_depth — Method
lnr.get_depth(node_index)Return the depth of node node_index in the trained learner.
Julia Equivalent: IAI.get_depth
get_parent — Method
lnr.get_parent(node_index)Return the index of the parent node of node node_index in the trained learner.
Julia Equivalent: IAI.get_parent
get_lower_child — Method
lnr.get_lower_child(node_index)Return the index of the lower child of node node_index in the trained learner.
Julia Equivalent: IAI.get_lower_child
get_upper_child — Method
lnr.get_upper_child(node_index)Return the index of the upper child of node node_index in the trained learner.
Julia Equivalent: IAI.get_upper_child
get_num_samples — Method
lnr.get_num_samples(node_index)Return the number of training points contained in node node_index in the trained learner.
Julia Equivalent: IAI.get_num_samples
is_categoric_split — Method
lnr.is_categoric_split(node_index)Return True if node node_index in the trained learner is a categoric split.
Julia Equivalent: IAI.is_categoric_split
is_hyperplane_split — Method
lnr.is_hyperplane_split(node_index)Return True if node node_index in the trained learner is a hyperplane split.
Julia Equivalent: IAI.is_hyperplane_split
is_leaf — Method
lnr.is_leaf(node_index)Return True if node node_index in the trained learner is a leaf.
Julia Equivalent: IAI.is_leaf
is_mixed_ordinal_split — Method
lnr.is_mixed_ordinal_split(node_index)Return True if node node_index in the trained learner is a mixed categoric/ordinal split.
Julia Equivalent: IAI.is_mixed_ordinal_split
is_mixed_parallel_split — Method
lnr.is_mixed_parallel_split(node_index)Return True if node node_index in the trained learner is a mixed categoric/parallel split.
Julia Equivalent: IAI.is_mixed_parallel_split
is_ordinal_split — Method
lnr.is_ordinal_split(node_index)Return True if node node_index in the trained learner is an ordinal split.
Julia Equivalent: IAI.is_ordinal_split
is_parallel_split — Method
lnr.is_parallel_split(node_index)Return True if node node_index in the trained learner is a parallel split.
Julia Equivalent: IAI.is_parallel_split
get_split_categories — Method
lnr.get_split_categories(node_index)Return the categoric/ordinal information used in the split at node node_index in the trained learner.
Julia Equivalent: IAI.get_split_categories
get_split_feature — Method
lnr.get_split_feature(node_index)Return the feature used in the split at node node_index in the trained learner.
Julia Equivalent: IAI.get_split_feature
get_split_threshold — Method
lnr.get_split_threshold(node_index)Return the threshold used in the split at node node_index in the trained learner.
Julia Equivalent: IAI.get_split_threshold
get_split_weights — Method
lnr.get_split_weights(node_index)Return the weights for numeric and categoric features used in the hyperplane split at node node_index in the trained learner.
Julia Equivalent: IAI.get_split_weights
missing_goes_lower — Method
lnr.missing_goes_lower(node_index)Return True if missing values take the lower branch at node node_index in the trained learner.
Julia Equivalent: IAI.missing_goes_lower
Tree learner visualization
write_png — Method
lnr.write_png(filename, **kwargs)Write learner to filename as a PNG image.
Before using this function, either run load_graphviz or ensure that Graphviz is installed and on the system PATH.
Julia Equivalent: IAI.write_png
write_pdf — Method
lnr.write_pdf(filename, **kwargs)Write learner to filename as a PDF image.
Before using this function, either run load_graphviz or ensure that Graphviz is installed and on the system PATH.
Julia Equivalent: IAI.write_pdf
write_svg — Method
lnr.write_svg(filename, **kwargs)Write learner to filename as an SVG image.
Before using this function, either run load_graphviz or ensure that Graphviz is installed and on the system PATH.
Julia Equivalent: IAI.write_svg
write_dot — Method
lnr.write_dot(filename, **kwargs)Write learner to filename in .dot format.
Julia Equivalent: IAI.write_dot
write_html — Method
lnr.write_html(filename, **kwargs)Write interactive browser visualization of learner to filename as HTML.
Julia Equivalent: IAI.write_html
show_in_browser — Method
lnr.show_in_browser(**kwargs)Show interactive visualization of learner in default browser.
Julia Equivalent: IAI.show_in_browser
write_questionnaire — Method
lnr.write_questionnaire(filename, **kwargs)Write interactive questionnaire based on learner to filename as HTML.
Julia Equivalent: IAI.write_questionnaire
show_questionnaire — Method
lnr.show_questionnaire(**kwargs)Show interactive questionnaire based on learner in default browser.
Julia Equivalent: IAI.show_questionnaire
TreePlot — Type
Specifies an interactive tree visualization.
Julia Equivalent: IAI.TreePlot
Parameters
Refer to the Julia documentation on advanced tree visualization for available parameters.
TreePlot — Method
iai.TreePlot(lnr, **kwargs)Construct a TreePlot based on the trained learner.
Julia Equivalent: IAI.TreePlot
MultiTreePlot — Type
Specify an interactive tree visualization of multiple tree learners
iai.MultiTreePlot(questions)Constructs an interactive tree visualization using multiple tree learners from specified questions. Refer to the documentation on advanced tree visualization for more information.
Julia Equivalent: IAI.MultiTreePlot
MultiTreePlot — Method
grid.MultiTreePlot()Construct a MultiTreePlot containing the final fitted learner from the trained grid search as well as the learner found for each parameter combination.
Julia Equivalent: IAI.MultiTreePlot
Questionnaire — Method
iai.Questionnaire(lnr, **kwargs)Construct a Questionnaire based on the trained learner.
Julia Equivalent: IAI.Questionnaire
ClassificationTreeLearner
ClassificationTreeLearner — Type
Abstract type encompassing all tree-based learners with classification leaves.
Julia Equivalent: IAI.ClassificationTreeLearner
get_classification_label — Method
lnr.get_classification_label(node_index)Return the predicted label at node node_index in the trained learner.
Julia Equivalent: IAI.get_classification_label
get_classification_proba — Method
lnr.get_classification_proba(node_index)Return the predicted probabilities of class membership at node node_index in the trained learner.
Julia Equivalent: IAI.get_classification_proba
get_regression_constant — Method
lnr.get_regression_constant(node_index)Return the constant term in the logistic regression prediction at node node_index in the trained learner.
Julia Equivalent: IAI.get_regression_constant
get_regression_weights — Method
lnr.get_regression_weights(node_index)Return the weights for each feature in the logistic regression prediction at node node_index in the trained learner.
Julia Equivalent: IAI.get_regression_weights
set_threshold — Method
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!
set_display_label — Method
lnr.set_display_label(display_label)Show the probability of display_label when visualizing learner.
Julia Equivalent: IAI.set_display_label!
reset_display_label — Method
lnr.reset_display_label(display_label)Reset the predicted probability displayed to be that of the predicted label when visualizing learner.
Julia Equivalent: IAI.reset_display_label!
RegressionTreeLearner
RegressionTreeLearner — Type
Abstract type encompassing all tree-based learners with regression leaves.
Julia Equivalent: IAI.RegressionTreeLearner
get_regression_constant — Method
lnr.get_regression_constant(node_index)Return the constant term in the regression prediction at node node_index in the trained learner.
Julia Equivalent: IAI.get_regression_constant
get_regression_weights — Method
lnr.get_regression_weights(node_index)Return the weights for each feature in the regression prediction at node node_index in the trained learner.
Julia Equivalent: IAI.get_regression_weights
SurvivalTreeLearner
SurvivalTreeLearner — Type
Abstract type encompassing all tree-based learners with survival leaves.
Julia Equivalent: IAI.SurvivalTreeLearner
get_survival_curve — Method
lnr.get_survival_curve(node_index)Return the SurvivalCurve at node node_index in the trained learner.
Julia Equivalent: IAI.get_survival_curve
get_survival_expected_time — Method
lnr.get_survival_expected_time(node_index)Return the predicted expected survival time at node node_index in the trained learner.
Julia Equivalent: IAI.get_survival_expected_time
get_survival_hazard — Method
lnr.get_survival_hazard(node_index)Return the predicted hazard ratio at node node_index in the trained learner.
Julia Equivalent: IAI.get_survival_hazard
get_regression_constant — Method
lnr.get_regression_constant(node_index)Return the constant term in the regression prediction at node node_index in the trained learner.
Julia Equivalent: IAI.get_regression_constant
get_regression_weights — Method
lnr.get_regression_weights(node_index)Return the weights for each feature in the regression prediction at node node_index in the trained learner.
Julia Equivalent: IAI.get_regression_weights
PrescriptionTreeLearner
PrescriptionTreeLearner — Type
Abstract type encompassing all tree-based learners with prescription leaves.
Julia Equivalent: IAI.PrescriptionTreeLearner
get_prescription_treatment_rank — Method
lnr.get_prescription_treatment_rank(node_index)Return the treatments ordered from most effective to least effective at node node_index in the trained learner.
Julia Equivalent: IAI.get_prescription_treatment_rank
get_regression_constant — Method
lnr.get_regression_constant(node_index, treatment)Return the constant in the regression prediction for treatment at node node_index in the trained learner.
Julia Equivalent: IAI.get_regression_constant
get_regression_weights — Method
lnr.get_regression_weights(node_index, treatment)Return the weights for each feature in the regression prediction for treatment at node node_index in the trained learner.
Julia Equivalent: IAI.get_regression_weights
PolicyTreeLearner
PolicyTreeLearner — Type
Abstract type encompassing all tree-based learners with policy leaves.
Julia Equivalent: IAI.PolicyTreeLearner
get_policy_treatment_rank — Method
lnr.get_policy_treatment_rank(node_index)Return the treatments ordered from most effective to least effective at node node_index in the trained learner.
Julia Equivalent: IAI.get_policy_treatment_rank
get_policy_treatment_outcome — Method
lnr.get_policy_treatment_outcome(node_index)Return the quality of the treatments at node node_index in the trained learner.
Julia Equivalent: IAI.get_policy_treatment_outcome
get_policy_treatment_outcome_standard_error — Method
lnr.get_policy_treatment_outcome_standard_error(node_index)Return the standard error for the quality of the treatments at node node_index in the trained learner.
Julia Equivalent: IAI.get_policy_treatment_outcome_standard_error
TreeMultiLearner
TreeMultiLearner — Type
Abstract type encompassing all multi-task tree-based learners.
Julia Equivalent: IAI.TreeMultiLearner
ClassificationTreeMultiLearner
ClassificationTreeMultiLearner — Type
Abstract type encompassing all multi-task tree-based learners with classification leaves.
Julia Equivalent: IAI.ClassificationTreeMultiLearner
get_classification_label — Method
Return the predicted label at node node_index in the trained learner.
lnr.get_classification_label(node_index)Return the label for all tasks.
Julia Equivalent: IAI.get_classification_label
lnr.get_classification_label(node_index, task_label)Return the label for a specified task.
Julia Equivalent: IAI.get_classification_label
get_classification_proba — Method
Return the predicted probabilities of class membership at node node_index in the trained learner.
lnr.get_classification_proba(node_index)Return the probabilities for all tasks.
Julia Equivalent: IAI.get_classification_proba
lnr.get_classification_proba(node_index, task_label)Return the probabilities for a specified task.
Julia Equivalent: IAI.get_classification_proba
get_regression_constant — Method
Return the constant term in the logistic regression prediction at node node_index in the trained learner.
lnr.get_regression_constant(node_index)Return the constant for all tasks.
Julia Equivalent: IAI.get_regression_constant
lnr.get_regression_constant(node_index, task_label)Return the constant for a specified task.
Julia Equivalent: IAI.get_regression_constant
get_regression_weights — Method
Return the weights for each feature in the logistic regression prediction at node node_index in the trained learner.
lnr.get_regression_weights(node_index)Return the weights for all tasks.
Julia Equivalent: IAI.get_regression_weights
lnr.get_regression_weights(node_index, task_label)Return the weights for a specified task.
Julia Equivalent: IAI.get_regression_weights
RegressionTreeMultiLearner
RegressionTreeMultiLearner — Type
Abstract type encompassing all multi-task tree-based learners with regression leaves.
Julia Equivalent: IAI.RegressionTreeMultiLearner
get_regression_constant — Method
Return the constant term in the regression prediction at node node_index in the trained learner.
lnr.get_regression_constant(node_index)Return the constant for all tasks.
Julia Equivalent: IAI.get_regression_constant
lnr.get_regression_constant(node_index, task_label)Return the constant for a specified task.
Julia Equivalent: IAI.get_regression_constant
get_regression_weights — Method
Return the weights for each feature in the regression prediction at node node_index in the trained learner.
lnr.get_regression_weights(node_index)Return the weights for all tasks.
Julia Equivalent: IAI.get_regression_weights
lnr.get_regression_weights(node_index, task_label)Return the weights for a specified task.
Julia Equivalent: IAI.get_regression_weights
Tree Stability
get_tree — Method
lnr.get_tree(index)Return a copy of the learner that uses the tree at index rather than the tree with the best training objective.
Julia Equivalent: IAI.get_tree
Stability Analysis
StabilityAnalysis — Type
Conduct a stability analysis of the trees in a tree learner.
Refer to the documentation on tree stability for more information.
Julia Equivalent: IAI.StabilityAnalysis
iai.StabilityAnalysis(lnr)Conduct a stability analysis of the trees in lnr, using similarity scores calculated during training
iai.StabilityAnalysis(lnr, X, y, criterion='default')Conduct a stability analysis of the trees in lnr, using similarity scores calculated with the data X, y and criterion
get_stability_results — Method
stability.get_stability_results()Return the trained trees in order of increasing objective value, along with their variable importance scores for each feature.
Julia Equivalent: IAI.get_stability_results
get_cluster_distances — Method
stability.get_cluster_distances(num_trees)Return the distances between the centroids of each pair of clusters, under the clustering of the best num_trees trees.
Julia Equivalent: IAI.get_cluster_distances
get_cluster_assignments — Method
stability.get_cluster_assignments(num_trees)Return the indices of the trees assigned to each cluster, under the clustering of the best num_trees trees.
Julia Equivalent: IAI.get_cluster_assignments
get_cluster_details — Method
stability.get_cluster_details(num_trees)Return the centroid information for each cluster, under the clustering of the best num_trees trees.
Julia Equivalent: IAI.get_cluster_details
plot — Method
stability.plot()Plot the stability analysis results.
Returns a matplotlib.figure.Figure containing the plotted results.
In a Jupyter Notebook, the plot will be shown automatically. In a terminal, you can show the plot with stability.plot().show().
Similarity Comparison
variable_importance_similarity — Method
Calculate similarity between this learner and another tree learner using variable importance scores.
Julia Equivalent: IAI.variable_importance_similarity
lnr.variable_importance_similarity(new_lnr)Calculate similarity scores between the final tree in this learner and all trees in new_lnr
lnr.variable_importance_similarity(new_lnr, X, y,Calculate similarity scores between the final tree in this learner and all trees in new_lnr using the data X and y with criterion
SimilarityComparison — Type
iai.SimilarityComparison(orig_lnr, new_lnr, deviations)Conduct a similarity comparison between the final tree in orig_lnr and all trees in new_lnr to consider the tradeoff between training performance and similarity to the original tree as measured by deviations.
Refer to the documentation on tree stability for more information.
Julia Equivalent: IAI.SimilarityComparison
get_train_errors — Method
lnr.get_train_errors()Extract the training objective value for each candidate tree in the comparison, where a lower value indicates a better solution.
Julia Equivalent: IAI.get_train_errors
plot — Method
similarity.plot()Plot the similarity comparison results.
Returns a matplotlib.figure.Figure containing the plotted results.
In a Jupyter Notebook, the plot will be shown automatically. In a terminal, you can show the plot with similarity.plot().show().
Optimal Trees
OptimalTreeLearner — Type
Abstract type encompassing all optimal tree learners.
Julia Equivalent: IAI.OptimalTreeLearner
OptimalTreeClassifier — Type
iai.OptimalTreeClassifier(**kwargs)Learner for training Optimal Classification Trees.
Julia Equivalent: IAI.OptimalTreeClassifier
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
OptimalTreeRegressor — Type
iai.OptimalTreeRegressor(**kwargs)Learner for training Optimal Regression Trees.
Julia Equivalent: IAI.OptimalTreeRegressor
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
OptimalTreeSurvivalLearner — Type
iai.OptimalTreeSurvivalLearner(**kwargs)Learner for training Optimal Survival Trees.
Julia Equivalent: IAI.OptimalTreeSurvivalLearner
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
OptimalTreePrescriptionMinimizer — Type
iai.OptimalTreePrescriptionMinimizer(**kwargs)Learner for training Optimal Prescriptive Trees where the prescriptions should aim to minimize outcomes.
Julia Equivalent: IAI.OptimalTreePrescriptionMinimizer
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
OptimalTreePrescriptionMaximizer — Type
iai.OptimalTreePrescriptionMaximizer(**kwargs)Learner for training Optimal Prescriptive Trees where the prescriptions should aim to maximize outcomes.
Julia Equivalent: IAI.OptimalTreePrescriptionMaximizer
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
OptimalTreePolicyMinimizer — Type
iai.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.
OptimalTreePolicyMaximizer — Type
iai.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.
OptimalTreeMultiLearner — Type
Abstract type encompassing all multi-task optimal tree learners.
Julia Equivalent: IAI.OptimalTreeMultiLearner
OptimalTreeMultiClassifier — Type
iai.OptimalTreeMultiClassifier(**kwargs)Learner for training multi-task Optimal Classification Trees.
Julia Equivalent: IAI.OptimalTreeMultiClassifier
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
OptimalTreeMultiRegressor — Type
iai.OptimalTreeMultiRegressor(**kwargs)Learner for training multi-task Optimal Regression Trees.
Julia Equivalent: IAI.OptimalTreeMultiRegressor
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
refit_leaves — Method
lnr.refit_leaves(X, y)Refit the models in the leaves of the trained learner using the supplied data.
Julia Equivalent: IAI.refit_leaves!
Parameters
Refer to the Julia documentation for available parameters.
copy_splits_and_refit_leaves — Method
lnr.copy_splits_and_refit_leaves(orig_lnr, X, y)Copy the tree split structure from orig_lnr into this learner and refit the models in each leaf of the tree using the supplied data.
Julia Equivalent: IAI.copy_splits_and_refit_leaves!
Parameters
Refer to the Julia documentation for available parameters.
prune_trees — Method
lnr.prune_trees(X, y)Use the trained trees in the learner along with the supplied validation data X and y to determine the best value for the cp parameter and then prune the trees according to this value.
Julia Equivalent: IAI.prune_trees!
Parameters
Refer to the Julia documentation for available parameters.
OptImpute
impute — Function
iai.impute(X, *args, **kwargs)Impute the missing values in X using either a specified method or through grid search validation.
Julia Equivalent: IAI.impute
This method was deprecated in interpretableai 2.9.0. This is for consistency with the IAI v3.0.0 Julia release.
Parameters
Refer to the Julia documentation for available parameters.
impute_cv — Function
iai.impute_cv(X, *args, **kwargs)Impute the missing values in X using cross validation.
Julia Equivalent: IAI.impute_cv
This method was deprecated in interpretableai 2.9.0. This is for consistency with the IAI v3.0.0 Julia release.
Parameters
Refer to the Julia documentation for available parameters.
OptKNNImputationLearner — Type
iai.OptKNNImputationLearner(**kwargs)Learner for conducting optimal k-NN imputation.
Julia Equivalent: IAI.OptKNNImputationLearner
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
OptSVMImputationLearner — Type
iai.OptSVMImputationLearner(**kwargs)Learner for conducting optimal SVM imputation.
Julia Equivalent: IAI.OptSVMImputationLearner
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
OptTreeImputationLearner — Type
iai.OptTreeImputationLearner(**kwargs)Learner for conducting optimal tree-based imputation.
Julia Equivalent: IAI.OptTreeImputationLearner
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
SingleKNNImputationLearner — Type
iai.SingleKNNImputationLearner(**kwargs)Learner for conducting heuristic k-NN imputation.
Julia Equivalent: IAI.SingleKNNImputationLearner
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
MeanImputationLearner — Type
iai.MeanImputationLearner(**kwargs)Learner for conducting mean imputation.
Julia Equivalent: IAI.MeanImputationLearner
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
RandImputationLearner — Type
iai.RandImputationLearner(**kwargs)Learner for conducting random imputation.
Julia Equivalent: IAI.RandImputationLearner
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
ZeroImputationLearner — Type
iai.ZeroImputationLearner(**kwargs)Learner for conducting zero-imputation.
Julia Equivalent: IAI.ZeroImputationLearner
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
fit_and_expand — Method
lnr.fit_and_expand(X, type='finite')Fit the imputation learner with training features X and create adaptive indicator features to encode the missing pattern according to type.
Julia Equivalent: IAI.fit_and_expand!
Parameters
Refer to the documentation on data preparation for information on how to format and supply the data.
transform_and_expand — Method
lnr.transform_and_expand(X, type='finite')Transform features X with the trained imputation learner and create adaptive indicator features to encode the missing pattern according to type.
Julia Equivalent: IAI.transform_and_expand
Parameters
Refer to the documentation on data preparation for information on how to format and supply the data.
Optimal Feature Selection
OptimalFeatureSelectionLearner — Type
Abstract type encompassing all Optimal Feature Selection learners.
Julia Equivalent: IAI.OptimalFeatureSelectionLearner
OptimalFeatureSelectionClassifier — Type
iai.OptimalFeatureSelectionClassifier(**kwargs)Learner for conducting Optimal Feature Selection on classification problems.
Julia Equivalent: IAI.OptimalFeatureSelectionClassifier
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
OptimalFeatureSelectionRegressor — Type
iai.OptimalFeatureSelectionRegressor(**kwargs)Learner for conducting Optimal Feature Selection on regression problems.
Julia Equivalent: IAI.OptimalFeatureSelectionRegressor
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
fit — Method
predict — Method
Return the prediction made by the learner for each point in the data X (see predict).
Julia Equivalent: IAI.predict
lnr.predict(X)Return the prediction made by the learner.
lnr.predict(X, fit_index=fit_index)Return the prediction made by cluster fit_index in the learner.
variable_importance — Method
Calculates the variable importance for the learner (see variable_importance).
Julia Equivalent: IAI.variable_importance
lnr.variable_importance()Return the variable_importance for the learner.
lnr.variable_importance(fit_index=fit_index)Return the variableimportance for cluster `fitindex` in the learner.
get_prediction_constant — Method
Return the constant term in the prediction in the trained learner.
Julia Equivalent: IAI.get_prediction_constant
lnr.get_prediction_constant()Return the constant term in the prediction
lnr.get_prediction_constant(fit_index=fit_index)Return the constant term in the prediction for cluster fit_index
get_prediction_weights — Method
Return the weights for numeric and categoric features used for prediction in the trained learner.
Julia Equivalent: IAI.get_prediction_weights
lnr.get_prediction_weights()Return the weights in the prediction
lnr.get_prediction_weights(fit_index=fit_index)Return the weights in the prediction for cluster fit_index
get_num_fits — Method
lnr.get_num_fits()Return the number of fits stored in the learner.
Julia Equivalent: IAI.get_num_fits
Questionnaire — Method
iai.Questionnaire(lnr, **kwargs)Construct a Questionnaire based on the trained learner.
Julia Equivalent: IAI.Questionnaire
write_questionnaire — Method
lnr.write_questionnaire(filename, **kwargs)Write interactive questionnaire based on learner to filename as HTML.
Julia Equivalent: IAI.write_questionnaire
show_questionnaire — Method
lnr.show_questionnaire(**kwargs)Show interactive questionnaire based on learner in default browser.
Julia Equivalent: IAI.show_questionnaire
plot — Method
grid.plot(type)Plot the grid search results for Optimal Feature Selection learners.
Returns a matplotlib.figure.Figure containing the plotted results.
In a Jupyter Notebook, the plot will be shown automatically. In a terminal, you can show the plot with grid.plot().show().
Parameters
type: (str) The type of plot to construct, either"validation"or"importance". For more information refer to the Julia documentation for plotting grid search results.
Reward Estimation
RewardEstimationLearner — Type
Abstract type encompassing all learners for reward estimation.
Julia Equivalent: IAI.RewardEstimationLearner
fit_predict — Method
Fit a reward estimation model and return predicted counterfactual rewards for each observation along with the scores of the internal estimators during training.
Julia Equivalent: IAI.fit_predict!
Categorical Treatments
CategoricalRewardEstimationLearner — Type
Abstract type encompassing all learners for reward estimation with categorical treatments.
Julia Equivalent: IAI.CategoricalRewardEstimationLearner
fit_predict — Method
Fit a reward estimation model and return predicted counterfactual rewards for each observation along with the scores of the internal estimators during training.
Julia Equivalent: IAI.fit_predict!
lnr.fit_predict(X, treatments, outcomes)For problems with classification or regression outcomes, fit reward estimation model on features X, treatments treatments, and outcomes outcomes and predict rewards for each observation.
lnr.fit_predict(X, treatments, deaths, times)For problems with survival outcomes, fit reward estimation model on features X, treatments treatments, death indicator deaths and event times times and predict rewards for each observation.
predict — Method
Return counterfactual rewards estimated by the learner for each observation in the supplied data.
Julia Equivalent: IAI.predict
lnr.predict(X, treatments, outcomes)For problems with classification or regression outcomes, predict rewards for each observation in the data given by X, treatments and outcomes. If using the direct method, treatments and outcomes can be omitted.
lnr.predict(X, treatments, deaths, times)For problems with survival outcomes, predict rewards for each observation in the data given by X, treatments, deaths and times. If using the direct method, treatments, deaths and times can be omitted.
predict_reward — Method
Return counterfactual rewards estimated using the learner parameters for each observation in the supplied data and predictions.
Julia Equivalent: IAI.predict_reward
lnr.predict_reward(treatments, outcomes, predictions)For problems with classification or regression outcomes, predict rewards for each observation in the data given by treatments and outcomes with predictions given by predictions.
lnr.predict_reward(treatments, deaths, times, predictions)For problems with survival outcomes, predict rewards for each observation in the data given by treatments, deaths and times, with predictions given by predictions.
score — Method
Calculate the scores of the internal estimators in the learner on the supplied data.
Returns a dict with the following entries:
'propensity': the score for the propensity estimator':outcome': adictwhere the keys are the possible treatments, and the values are the scores of the outcome estimator corresponding to each treatment
Julia Equivalent: IAI.score
lnr.score(X, treatments, outcomes)For problems with classification or regression outcomes, calculate the scores of the internal estimators using the data given by X, treatments and outcomes.
lnr.score(X, treatments, deaths, times)For problems with survival outcomes, calculate the scores of the internal estimators using the data given by X, treatments, deaths and times.
CategoricalClassificationRewardEstimator — Type
iai.CategoricalClassificationRewardEstimator(**kwargs)Learner for reward estimation with categorical treatments and classification outcomes.
Julia Equivalent: IAI.CategoricalClassificationRewardEstimator
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
CategoricalRegressionRewardEstimator — Type
iai.CategoricalRegressionRewardEstimator(**kwargs)Learner for reward estimation with categorical treatments and regression outcomes.
Julia Equivalent: IAI.CategoricalRegressionRewardEstimator
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
CategoricalSurvivalRewardEstimator — Type
iai.CategoricalSurvivalRewardEstimator(**kwargs)Learner for reward estimation with categorical treatments and survival outcomes.
Julia Equivalent: IAI.CategoricalSurvivalRewardEstimator
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
EqualPropensityEstimator — Type
iai.EqualPropensityEstimator(**kwargs)Learner that estimates equal propensity for all treatments.
For use with data from randomized experiments where treatments are known to be randomly assigned.
Julia Equivalent: IAI.EqualPropensityEstimator
Numeric Treatments
NumericRewardEstimationLearner — Type
Abstract type encompassing all learners for reward estimation with numeric treatments.
Julia Equivalent: IAI.NumericRewardEstimationLearner
fit_predict — Method
Fit a reward estimation model and return predicted counterfactual rewards for each observation under each treatment option in treatment_candidates, as well as the score of the internal outcome estimator.
Julia Equivalent: IAI.fit_predict!
lnr.fit_predict(X, treatments, outcomes, treatment_candidates)For problems with classification or regression outcomes, fit reward estimation model on features X, treatments treatments, and outcomes outcomes and predict rewards for each observation under each treatment option in treatment_candidates.
lnr.fit_predict(X, treatments, deaths, times, treatment_candidates)For problems with survival outcomes, fit reward estimation model on features X, treatments treatments, death indicator deaths and event times times and predict rewards for each observation under each treatment option in treatment_candidates.
predict — Method
Return counterfactual rewards estimated by the learner for each observation in the supplied data.
Julia Equivalent: IAI.predict
lnr.predict(X, treatments, outcomes)IAI versions 2.2 and greater: For problems with classification or regression outcomes, predict rewards for each observation in the data given by X, treatments and outcomes. If using the direct method, treatments and outcomes can be omitted.
lnr.predict(X, treatments, deaths, times)IAI versions 2.2 and greater: For problems with survival outcomes, predict rewards for each observation in the data given by X, treatments, deaths and times. If using the direct method, treatments, deaths and times can be omitted.
lnr.predict(X, treatments, outcomes, treatment_candidates)IAI version 2.1: Predicted reward for each observation in the data given by X, treatments and outcomes under each treatment option in treatment_candidates. If using the direct method, treatments, deaths and times can be omitted.
predict_reward — Method
Return counterfactual rewards estimated using the learner parameters for each observation in the supplied data and predictions.
Julia Equivalent: IAI.predict_reward
lnr.predict_reward(X, treatments, outcomes, predictions)For problems with classification or regression outcomes, predict rewards for each observation in the data given by treatments and outcomes with predictions given by predictions.
lnr.predict_reward(X, treatments, deaths, times, predictions)For problems with survival outcomes, predict rewards for each observation in the data given by treatments, deaths and times with predictions given by predictions.
score — Method
Calculate the scores of the internal estimator in the learner on the supplied data.
Julia Equivalent: IAI.score
On IAI versions 2.2 and greater, returns a dict with the following entries:
'propensity': adictwhere the keys are the treatment candidates, and the values are the scores of the propensity estimator corresponding to each candidate':outcome': adictwhere the keys are the treatment candidates, and the values are the scores of the outcome estimator corresponding to each candidate
On IAI version 2.1, returns a float giving the score of the outcome estimator.
lnr.score(X, treatments, outcomes)For problems with classification or regression outcomes, calculate the scores of the internal estimators using the data given by X, treatments and outcomes.
lnr.score(X, treatments, deaths, times)For problems with survival outcomes, calculate the scores of the internal estimators using the data given by X, treatments, deaths and times.
NumericClassificationRewardEstimator — Type
iai.NumericClassificationRewardEstimator(**kwargs)Learner for reward estimation with numeric treatments and classification outcomes.
Julia Equivalent: IAI.NumericClassificationRewardEstimator
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
NumericRegressionRewardEstimator — Type
iai.NumericRegressionRewardEstimator(**kwargs)Learner for reward estimation with numeric treatments and regression outcomes.
Julia Equivalent: IAI.NumericRegressionRewardEstimator
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
NumericSurvivalRewardEstimator — Type
iai.NumericSurvivalRewardEstimator(**kwargs)Learner for reward estimation with numeric treatments and survival outcomes.
Julia Equivalent: IAI.NumericSurvivalRewardEstimator
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
get_estimation_densities — Method
lnr.get_estimation_densities()Return the total kernel density surrounding each treatment candidate for the propensity/outcome estimation problems in the fitted learner.
Julia Equivalent: IAI.get_estimation_densities
tune_reward_kernel_bandwidth — Method
lnr.tune_reward_kernel_bandwidth(input_bandwidths)Conduct the reward kernel bandwidth tuning procedure using the learner for each starting value in input_bandwidths and return the final tuned values.
Julia Equivalent: IAI.tune_reward_kernel_bandwidth
set_reward_kernel_bandwidth — Method
lnr.set_reward_kernel_bandwidth(bandwidth)Save the new value of bandwidth as the reward kernel bandwidth inside the learner, and return new reward predictions generated using this bandwidth for the original data used to train the learner.
Julia Equivalent: IAI.set_reward_kernel_bandwidth!
all_treatment_combinations — Function
iai.all_treatment_combinations(*args, **kwargs)Return a pandas.DataFrame containing all treatment combinations of one or more treatment vectors, ready for use as treatment_candidates in fit_predict! or predict.
Julia Equivalent: IAI.all_treatment_combinations
convert_treatments_to_numeric — Function
iai.convert_treatments_to_numeric(treatments)Convert treatments from symbol/string format into numeric values.
Julia Equivalent: IAI.convert_treatments_to_numeric
Heuristics
Random Forests
RandomForestLearner — Type
Abstract type encompassing all random forest learners.
Julia Equivalent: IAI.RandomForestLearner
RandomForestClassifier — Type
iai.RandomForestClassifier(**kwargs)Learner for training random forests for classification problems.
Julia Equivalent: IAI.RandomForestClassifier
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
RandomForestRegressor — Type
iai.RandomForestRegressor(**kwargs)Learner for training random forests for regression problems.
Julia Equivalent: IAI.RandomForestRegressor
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
RandomForestSurvivalLearner — Type
iai.RandomForestSurvivalLearner(**kwargs)Learner for training random forests for survival problems.
Julia Equivalent: IAI.RandomForestSurvivalLearner
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
XGBoost
XGBoostLearner — Type
Abstract type encompassing all XGBoost learners.
Julia Equivalent: IAI.XGBoostLearner
XGBoostClassifier — Type
iai.XGBoostClassifier(**kwargs)Learner for training XGBoost models for classification problems.
Julia Equivalent: IAI.XGBoostClassifier
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
XGBoostRegressor — Type
iai.XGBoostRegressor(**kwargs)Learner for training XGBoost models for regression problems.
Julia Equivalent: IAI.XGBoostRegressor
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
XGBoostSurvivalLearner — Type
iai.XGBoostSurvivalLearner(**kwargs)Learner for training XGBoost models for survival problems.
Julia Equivalent: IAI.XGBoostSurvivalLearner
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
predict_shap — Method
lnr.predict_shap(X)Calculate SHAP values for all points in the features X using lnr.
Julia Equivalent: IAI.predict_shap
write_booster — Method
lnr.write_booster(filename)Write the internal booster saved in the learner to filename.
Julia Equivalent: IAI.write_booster
GLMNet
GLMNetLearner — Type
Abstract type encompassing all GLMNet learners.
Julia Equivalent: IAI.GLMNetLearner
get_num_fits — Method
lnr.get_num_fits()Return the number of fits along the path in the trained learner.
Julia Equivalent: IAI.get_num_fits
get_prediction_weights — Method
Return the weights for numeric and categoric features used for prediction in the trained learner.
Julia Equivalent: IAI.get_prediction_weights
lnr.get_prediction_weights()Return the weights for each feature in the prediction made by the best fit on the path in the learner.
lnr.get_prediction_weights(fit_index)Return the weights for each feature in the prediction made by the fit at fit_index on the path in the learner.
get_prediction_constant — Method
Return the constant term in the prediction in the trained learner.
Julia Equivalent: IAI.get_prediction_constant
lnr.get_prediction_constant()Return the constant term in the prediction made by the best fit on the path in the learner.
lnr.get_prediction_constant(fit_index)Return the constant term in the prediction made by the fit at fit_index on the path in the learner.
GLMNetCVLearner — Type
Abstract type encompassing all GLMNet learners using cross-validation.
Julia Equivalent: IAI.GLMNetCVLearner
predict — Method
Return the prediction made by the learner for each point in the data X.
Julia Equivalent: IAI.predict
lnr.predict(X)Return the prediction made by the best fit on the path in the learner.
lnr.predict(X, fit_index)Return the prediction made by the fit at fit_index on the path in the learner.
score — Method
Calculate the score for the learner on data X and y
Julia Equivalent: IAI.score
lnr.score(X, *y, **kwargs)Calculate the score for by the best fit on the path in the learner.
lnr.score(X, *y, fit_index=fit_index, **kwargs)Calculate the score for by the fit at fit_index on the path in the learner.
GLMNetCVClassifier — Type
iai.GLMNetCVClassifier(**kwargs)Learner for training GLMNet models for classification problems with cross-validation.
Julia Equivalent: IAI.GLMNetCVClassifier
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
predict_proba — Method
Return the probabilities of class membership predicted by the learner for each point in the data X.
Julia Equivalent: IAI.predict_proba
lnr.predict_proba(X)Return the probabilities of class membership predicted by the best fit on the path in the learner.
lnr.predict_proba(X, fit_index)Return the probabilities of class membership predicted by the fit at fit_index on the path in the learner.
ROCCurve — Method
Construct an ROCCurve using the trained learner on the features X and labels y
Julia Equivalent: IAI.ROCCurve
lnr.predict_proba(X)Construct an ROCCurve using by the best fit on the path in the learner.
iai.ROCCurve(lnr, X, y, fit_index=fit_index)Construct an ROCCurve using by the fit at fit_index on the path in the learner.
GLMNetCVRegressor — Type
iai.GLMNetCVRegressor(**kwargs)Learner for training GLMNet models for regression problems with cross-validation.
Julia Equivalent: IAI.GLMNetCVRegressor
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
GLMNetCVSurvivalLearner — Type
iai.GLMNetCVSurvivalLearner(**kwargs)Learner for training GLMNet models for survival problems with cross-validation.
Julia Equivalent: IAI.GLMNetCVSurvivalLearner
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
predict_hazard — Method
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
lnr.predict_hazard(X)Return the hazard coefficient estimated made by the best fit on the path in the learner.
lnr.predict_hazard(X, fit_index)Return the hazard coefficient estimated made by the fit at fit_index on the path in the learner.
predict_expected_survival_time — Method
Return the expected survival time estimate made by the learner for each point in the data X.
Julia Equivalent: IAI.predict_expected_survival_time
lnr.predict_expected_survival_time(X)Return the expected survival time made by the best fit on the path in the learner.
lnr.predict_expected_survival_time(X, fit_index)Return the expected survival time made by the fit at fit_index on the path in the learner.
Miscellaneous Types
ROCCurve
ROCCurve — Type
Container for ROC curve information.
Julia Equivalent: IAI.ROCCurve
iai.ROCCurve(probs, y, positive_label=positive_label)Construct a ROCCurve using predicted probabilities probs and true labels y, with probabilities indicating chance of predicting positive_label:
Julia Equivalent: IAI.ROCCurve
get_data — Method
curve.get_data()Extract the underlying data from the curve as a dict with two keys:
coords: adictfor 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.get_roc_curve_data
plot — Method
curve.plot()Plot the ROC curve using matplotlib.
Returns a matplotlib.figure.Figure containing the ROC curve.
In a Jupyter Notebook, the plot will be shown automatically. In a terminal, you can show the plot with curve.plot().show().
write_html — Method
lnr.write_html(filename, **kwargs)Write interactive browser visualization of the ROC curve to filename as HTML.
Julia Equivalent: IAI.write_html
show_in_browser — Method
SurvivalCurve
SurvivalCurve — Type
Container for survival curve information.
Use curve[t] to get the survival probability prediction from curve at time t.
Julia Equivalent: IAI.SurvivalCurve
get_data — Method
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
predict_expected_survival_time — Method
curve.predict_expected_survival_time()Return the expected survival time according to the curve
Julia Equivalent: IAI.predict_expected_survival_time