API Reference
Documentation for the interpretableai
package
Index
AbstractVisualization
CategoricalRewardEstimationLearner
CategoricalRewardEstimator
ClassificationLearner
ClassificationTreeLearner
GridSearch
ImputationLearner
Learner
MeanImputationLearner
MixedData
MultiQuestionnaire
MultiQuestionnaire
MultiTreePlot
MultiTreePlot
OptKNNImputationLearner
OptSVMImputationLearner
OptTreeImputationLearner
OptimalFeatureSelectionClassifier
OptimalFeatureSelectionLearner
OptimalFeatureSelectionRegressor
OptimalTreeClassifier
OptimalTreeLearner
OptimalTreePolicyMaximizer
OptimalTreePolicyMinimizer
OptimalTreePrescriptionMaximizer
OptimalTreePrescriptionMinimizer
OptimalTreeRegressor
OptimalTreeSurvivalLearner
PolicyLearner
PolicyTreeLearner
PrescriptionLearner
PrescriptionTreeLearner
Questionnaire
Questionnaire
ROCCurve
ROCCurve
RandImputationLearner
RegressionLearner
RegressionTreeLearner
SingleKNNImputationLearner
SupervisedLearner
SurvivalCurve
SurvivalLearner
SurvivalTreeLearner
TreeLearner
TreePlot
TreePlot
UnsupervisedLearner
add_julia_processes
apply
apply_nodes
cleanup_installation
clone
decision_path
delete_rich_output_param
fit
fit
fit
fit
fit_cv
fit_predict
fit_transform
fit_transform_cv
get_best_params
get_classification_label
get_classification_proba
get_data
get_depth
get_grid_result_summary
get_learner
get_lower_child
get_machine_id
get_num_nodes
get_num_samples
get_params
get_parent
get_policy_treatment_rank
get_prediction_constant
get_prediction_weights
get_prescription_treatment_rank
get_regression_constant
get_regression_constant
get_regression_weights
get_regression_weights
get_rich_output_params
get_split_categories
get_split_feature
get_split_threshold
get_split_weights
get_survival_curve
get_upper_child
impute
impute_cv
install
install_julia
install_system_image
is_categoric_split
is_hyperplane_split
is_leaf
is_mixed_ordinal_split
is_mixed_parallel_split
is_ordinal_split
is_parallel_split
load_graphviz
missing_goes_lower
predict
predict
predict
predict_expected_survival_time
predict_expected_survival_time
predict_hazard
predict_outcomes
predict_outcomes
predict_proba
print_path
read_json
reset_display_label
score
score
set_display_label
set_julia_seed
set_params
set_rich_output_param
set_threshold
show_in_browser
show_in_browser
show_in_browser
show_questionnaire
split_data
transform
variable_importance
variable_importance
variable_importance
write_dot
write_html
write_html
write_html
write_json
write_png
write_questionnaire
Setup
install
— Functioninstall(**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
— Functioninstall_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
— Functioninstall_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 toTrue
to confirm that you agree to the End User License Agreement and skip the interactive confirmation dialog.
cleanup_installation
— Functioncleanup_installation()
Remove all files created by install_julia
and install_system_image
.
get_machine_id
— Functioniai.get_machine_id()
Return the machine ID for the current computer.
load_graphviz
— Functioniai.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
— Functionadd_julia_processes
— Functioniai.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
— Functioniai.read_json(filename)
Read in a learner or grid saved in JSON format from filename
.
Julia Equivalent: IAI.read_json
get_rich_output_params
— Functioniai.get_rich_output_params()
Return the current global rich output parameter settings.
Julia Equivalent: IAI.get_rich_output_params
set_rich_output_param
— Functioniai.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
— Functioniai.delete_rich_output_param(key)
Delete the global rich output parameter key
.
Julia Equivalent: IAI.delete_rich_output_param!
Data Preparation
MixedData
— Typeiai.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_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_data
— Functioniai.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
Learner
— TypeAbstract type encompassing all learners.
Julia Equivalent: IAI.Learner
fit
— Methodlnr.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
— Methodget_params
— Methodclone
— Methodlnr.clone()
Return an unfitted copy of the learner with the same parameters.
Julia Equivalent: IAI.clone
write_json
— Methodlnr.write_json(filename, **kwargs)
Write learner or grid to filename
in JSON format.
Julia Equivalent: IAI.write_json
variable_importance
— Methodlnr.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
SupervisedLearner
SupervisedLearner
— TypeAbstract type encompassing all learners for supervised tasks.
Julia Equivalent: IAI.SupervisedLearner
predict
— Methodlnr.predict(X)
Return the predictions made by the learner for each point in the features X
.
Julia Equivalent: IAI.predict
score
— Methodlnr.score(X, *y, **kwargs)
Calculates the score for the learner on data X
and y
.
Julia Equivalent: IAI.score
UnsupervisedLearner
UnsupervisedLearner
— TypeAbstract type encompassing all learners for unsupervised tasks.
Julia Equivalent: IAI.UnsupervisedLearner
ClassificationLearner
ClassificationLearner
— TypeAbstract type encompassing all learners for classification tasks.
Julia Equivalent: IAI.ClassificationLearner
predict_proba
— Methodlnr.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
— Methodlnr.ROCCurve(X, y)
Construct an ROCCurve
using the trained learner on the features X
and labels y
Julia Equivalent: IAI.ROCCurve
RegressionLearner
RegressionLearner
— TypeAbstract type encompassing all learners for regression tasks.
Julia Equivalent: IAI.RegressionLearner
SurvivalLearner
SurvivalLearner
— TypeAbstract type encompassing all learners for survival tasks.
Julia Equivalent: IAI.SurvivalLearner
predict
— MethodReturn 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
— Methodlnr.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
Requires IAI version 1.2 or higher.
predict_expected_survival_time
— Methodlnr.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
Requires IAI version 2.0 or higher.
PrescriptionLearner
PrescriptionLearner
— TypeAbstract type encompassing all learners for prescription tasks.
Julia Equivalent: IAI.PrescriptionLearner
predict_outcomes
— Methodlnr.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
— TypeAbstract type encompassing all learners for policy tasks.
Julia Equivalent: IAI.PolicyLearner
predict_outcomes
— Methodlnr.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
Requires IAI version 2.0 or higher.
ImputationLearner
ImputationLearner
— Typeiai.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
— Methodlnr.fit(X, **kwargs)
Fit a model using the parameters in learner and the data X
(see [
fit`](@ref fit(::Learner))).
Additional keyword arguments are available for fitting imputation learners - please refer to the Julia documentation.
Julia Equivalent: IAI.fit!
fit_transform
— Methodlnr.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
— Methodlnr.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.
GridSearch
GridSearch
— Typeiai.GridSearch(lnr, params)
Controls grid search over parameter combinations in params
for lnr
.
Julia Equivalent: IAI.GridSearch
fit
— Methodgrid.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
— Methodgrid.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
— Methodgrid.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
— Methodgrid.get_learner()
Return the fitted learner using the best parameter combination from the grid.
Julia Equivalent: IAI.get_learner
get_best_params
— Methodgrid.get_best_params()
Return the best parameter combination from the grid.
Julia Equivalent: IAI.get_best_params
get_grid_result_summary
— Methodgrid.get_grid_result_summary()
Return a summary of the results from the grid search.
Julia Equivalent: IAI.get_grid_result_summary
Visualizations
AbstractVisualization
— TypeAbstract type encompassing objects related to visualization.
Julia Equivalent: IAI.AbstractVisualization
write_html
— Methodtreeplot.write_html(filename, **kwargs)
Write interactive browser visualization to filename
as HTML.
Julia Equivalent: IAI.write_html
show_in_browser
— Methodtreeplot.show_in_browser(**kwargs)
Show interactive visualization in default browser.
Julia Equivalent: IAI.show_in_browser
Questionnaire
— TypeSpecifies an interactive questionnaire.
Julia Equivalent: IAI.Questionnaire
Parameters
Refer to the Julia documentation on advanced tree visualization for available parameters.
Requires IAI version 1.1 or higher.
MultiQuestionnaire
— TypeSpecify an interactive questionnaire of multiple learners
Requires IAI version 1.1 or higher.
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
— Methodgrid.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
Requires IAI version 2.0 or higher.
Tree Learners
TreeLearner
TreeLearner
— TypeAbstract type encompassing all tree-based learners.
Julia Equivalent: IAI.TreeLearner
apply
— Methodlnr.apply(X)
Return the leaf index in the learner into which each point in the features X
falls.
Julia Equivalent: IAI.apply
apply_nodes
— Methodlnr.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
— Methodlnr.decision_path(X)
Return a matrix where entry (i, j)
is True
if the i
th point in the features X
passes through the j
th node in the learner.
Julia Equivalent: IAI.decision_path
print_path
— Methodlnr.print_path(X)
Print the decision path through the learner for each sample in the features X
.
Julia Equivalent: IAI.print_path
variable_importance
— MethodCalculate 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
— Methodlnr.get_num_nodes(node_index)
Return the number of nodes in the trained learner.
Julia Equivalent: IAI.get_num_nodes
get_depth
— Methodlnr.get_depth(node_index)
Return the depth of node node_index
in the trained learner.
Julia Equivalent: IAI.get_depth
get_parent
— Methodlnr.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
— Methodlnr.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
— Methodlnr.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
— Methodlnr.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
— Methodlnr.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
— Methodlnr.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
— Methodlnr.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
— Methodlnr.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
— Methodlnr.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
— Methodlnr.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
— Methodlnr.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
— Methodlnr.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
— Methodlnr.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
— Methodlnr.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
— Methodlnr.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
— Methodlnr.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
— Methodlnr.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_dot
— Methodlnr.write_dot(filename, **kwargs)
Write learner to filename
in .dot format.
Julia Equivalent: IAI.write_dot
write_html
— Methodlnr.write_html(filename, **kwargs)
Write interactive browser visualization of learner to filename
as HTML.
Julia Equivalent: IAI.write_html
show_in_browser
— Methodlnr.show_in_browser(**kwargs)
Show interactive visualization of learner in default browser.
Julia Equivalent: IAI.show_in_browser
write_questionnaire
— Methodlnr.write_questionnaire(filename, **kwargs)
Write interactive questionnaire based on learner to filename
as HTML.
Julia Equivalent: IAI.write_questionnaire
show_questionnaire
— Methodlnr.show_questionnaire(**kwargs)
Show interactive questionnaire based on learner in default browser.
Julia Equivalent: IAI.show_questionnaire
TreePlot
— TypeSpecifies an interactive tree visualization.
Julia Equivalent: IAI.TreePlot
Parameters
Refer to the Julia documentation on advanced tree visualization for available parameters.
Requires IAI version 1.1 or higher.
TreePlot
— Methodiai.TreePlot(lnr, **kwargs)
Construct a TreePlot
based on the trained learner.
Julia Equivalent: IAI.TreePlot
Requires IAI version 1.1 or higher.
MultiTreePlot
— TypeSpecify an interactive tree visualization of multiple tree learners
Requires IAI version 1.1 or higher.
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
— Methodgrid.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
Requires IAI version 2.0 or higher.
Questionnaire
— Methodiai.Questionnaire(lnr, **kwargs)
Construct a Questionnaire
based on the trained learner.
Julia Equivalent: IAI.Questionnaire
Requires IAI version 1.1 or higher.
ClassificationTreeLearner
ClassificationTreeLearner
— TypeAbstract type encompassing all tree-based learners with classification leaves.
Julia Equivalent: IAI.ClassificationTreeLearner
get_classification_label
— Methodlnr.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
— Methodlnr.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
set_threshold
— Methodlnr.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
— Methodlnr.set_display_label(display_label)
Show the probability of display_label
when visualizing learner.
Julia Equivalent: IAI.set_display_label!
reset_display_label
— Methodlnr.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
— TypeAbstract type encompassing all tree-based learners with regression leaves.
Julia Equivalent: IAI.RegressionTreeLearner
get_regression_constant
— Methodlnr.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
— Methodlnr.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
— TypeAbstract type encompassing all tree-based learners with survival leaves.
Julia Equivalent: IAI.SurvivalTreeLearner
get_survival_curve
— Methodlnr.get_survival_curve(node_index)
Return the SurvivalCurve
at node node_index
in the trained learner.
Julia Equivalent: IAI.get_survival_curve
PrescriptionTreeLearner
PrescriptionTreeLearner
— TypeAbstract type encompassing all tree-based learners with prescription leaves.
Julia Equivalent: IAI.PrescriptionTreeLearner
get_prescription_treatment_rank
— Methodlnr.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
— Methodlnr.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
— Methodlnr.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
— TypeAbstract type encompassing all tree-based learners with policy leaves.
Julia Equivalent: IAI.PolicyTreeLearner
get_policy_treatment_rank
— Methodlnr.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
Requires IAI version 2.0 or higher.
Optimal Trees
OptimalTreeLearner
— TypeAbstract type encompassing all optimal tree learners.
Julia Equivalent: IAI.OptimalTreeLearner
OptimalTreeClassifier
— Typeiai.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
— Typeiai.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
— Typeiai.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
— Typeiai.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
— Typeiai.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
— Typeiai.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.
Requires IAI version 2.0 or higher.
OptimalTreePolicyMaximizer
— Typeiai.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.
Requires IAI version 2.0 or higher.
OptImpute
impute
— Functioniai.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
— Functioniai.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
— Typeiai.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
— Typeiai.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
— Typeiai.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
— Typeiai.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
— Typeiai.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
— Typeiai.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.
Optimal Feature Selection
OptimalFeatureSelectionLearner
— TypeAbstract type encompassing all Optimal Feature Selection learners.
Julia Equivalent: IAI.OptimalFeatureSelectionLearner
OptimalFeatureSelectionClassifier
— Typeiai.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.
Requires IAI version 1.1 or higher.
OptimalFeatureSelectionRegressor
— Typeiai.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.
Requires IAI version 1.1 or higher.
fit
— Methodlnr.fit(X, *y, sample_weight=None, **kwargs)
Fit a model using the parameters in learner and the data X
and y
(see fit
).
When the coordinated_sparsity
parameter of the learner is True
, additional keyword arguments are required - please refer to the Julia documentation.
Julia Equivalent: IAI.fit!
Requires IAI version 1.1 or higher.
predict
— MethodReturn the prediction made by the learner for each point in the data X
(see predict
).
Julia Equivalent: IAI.predict
Requires IAI version 1.1 or higher.
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.
score
— MethodCalculates the score for the learner on data X
and y
(see score
).
Julia Equivalent: IAI.score
Requires IAI version 1.1 or higher.
lnr.score(X, *y, **kwargs)
Calculates the score for the learner.
lnr.score(X, *y, **kwargs, fit_index=fit_index)
Calculates the score for cluster fit_index
in the learner.
variable_importance
— MethodCalculates the variable importance for the learner (see variable_importance
).
Julia Equivalent: IAI.variable_importance
Requires IAI version 1.1 or higher.
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
— MethodReturn the constant term in the prediction in the trained learner.
Julia Equivalent: IAI.get_prediction_constant
Requires IAI version 1.1 or higher.
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
— MethodReturn the weights for numeric and categoric features used for prediction in the trained learner.
Julia Equivalent: IAI.get_prediction_weights
Requires IAI version 1.1 or higher.
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
Reward Estimation
CategoricalRewardEstimationLearner
— TypeAbstract type encompassing all learners for reward estimation with categorical treatments.
Julia Equivalent: IAI.CategoricalRewardEstimationLearner
fit_predict
— MethodFit 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!
Requires IAI version 2.0 or higher.
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.
CategoricalRewardEstimator
— Typeiai.CategoricalRewardEstimator(**kwargs)
Learner for reward estimation with categorical treatments.
This class was deprecated in interpretableai 2.6.0, and CategoricalClassificationRewardEstimator or CategoricalRegressionRewardEstimator should be used instead. This is for consistency with the IAI v2.1.0 Julia release. This deprecation is no longer supported as of the IAI v3 release.
Parameters
Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
Requires IAI version 2.0, 2.1 or 2.2.
Miscellaneous Types
ROCCurve
ROCCurve
— TypeContainer 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
write_html
— Methodlnr.write_html(filename, **kwargs)
Write interactive browser visualization of the ROC curve to filename
as HTML.
Julia Equivalent: IAI.write_html
Requires IAI version 1.1 or higher.
show_in_browser
— MethodSurvivalCurve
SurvivalCurve
— TypeContainer for survival curve information.
Use curve[t]
to get the survival probability prediction from curve at time t
.
Julia Equivalent: IAI.SurvivalCurve
get_data
— Methodcurve.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
— Methodcurve.predict_expected_survival_time()
Return the expected survival time according to the curve
Julia Equivalent: IAI.predict_expected_survival_time
Requires IAI version 2.2 or higher.