API Reference

Documentation for the iai package

Index

Setup

iai::iai_setupFunction
iai_setup(...)

Initialize Julia and the IAI package.

This function is called automatically with default parameters the first time any iai function is used in an R session. If custom parameters for Julia setup are required, this function must be called in every R session before calling other iai functions.

Arguments

iai::install_juliaFunction
install_julia(version = "latest", prefix = julia_default_install_dir())

Download and install Julia automatically.

Arguments

  • version: The version of Julia to install (e.g. "1.6.3"). Defaults to "latest", which will install the most recent stable release.
  • prefix: The directory where Julia will be installed. Defaults to a location determined by rappdirs::user_data_dir.
iai::install_system_imageFunction
install_system_image(
  version = "latest",
  replace_default = FALSE,
  prefix = sysimage_default_install_dir(),
  accept_license = FALSE
)

Download and install the IAI system image automatically.

Arguments

  • version: 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: Whether to replace the default Julia system image with the downloaded IAI system image. Defaults to FALSE.
  • prefix: The directory where the IAI system image will be installed. Defaults to a location determined by rappdirs::user_data_dir.
  • accept_license: Set to TRUE to confirm that you agree to the End User License Agreement and skip the interactive confirmation dialog.
iai::get_machine_idFunction
get_machine_id()

Return the machine ID for the current computer.

This ID ties the IAI license file to your machine.

iai::load_graphvizFunction
load_graphviz()

Loads the Julia Graphviz library to permit certain visualizations.

The library will be installed if not already present.

General Utilities

Data Preparation

iai::as.mixeddataFunction
as.mixeddata(values, categorical_levels, ordinal_levels = c())

Convert a vector of values to IAI mixed data format

Julia Equivalent: IAI.make_mixed_data

Arguments

  • values: The vector of values to convert
  • categorical_levels: The values in values to treat as categoric levels
  • ordinal_levels: (optional) The values in values to treat as ordinal levels, in the order supplied
iai::split_dataFunction
split_data(task, X, ...)

Split the data into training and test datasets

Julia Equivalent: IAI.split_data

Arguments

  • task: The type of problem.
  • X: The features of the data.
  • ...: Other parameters, including zero or more target vectors as required by the problem type. Refer to the Julia documentation for available parameters.

Scoring

iai::score.defaultFunction
score(obj, predictions, truths, ...)

Calculate the score for a set of predictions on the given data

Julia Equivalent: IAI.score

Arguments

  • obj: The type of problem.
  • predictions: The predictions to evaluate.
  • truths: The true target values for these observations.
  • ...: Other parameters, including the criterion. Refer to the Julia documentation for available parameters.
IAI Compatibility

Requires IAI version 2.1 or higher.

Learners

General learners

iai::fit.learnerFunction
fit(obj, X, ...)

Fits a model to the training data

Julia Equivalent: IAI.fit!

Arguments

  • obj: The learner to fit.
  • X: The features of the data.
  • ...: Other parameters, including zero or more target vectors as required by the problem type. Refer to the Julia documentation for available parameters.
iai::variable_importance.learnerFunction
variable_importance(obj, ...)

Generate a ranking of the variables in a learner according to their importance during training. The results are normalized so that they sum to one.

Julia Equivalent: IAI.variable_importance

Arguments

  • obj: The learner to query.
  • ...: Refer to the Julia documentation for available parameters.
iai::set_paramsFunction
set_params(lnr, ...)

Set all supplied parameters on a learner

Julia Equivalent: IAI.set_params!

Arguments

  • lnr: The learner to modify.
  • ...: The parameters to set on the learner.
iai::get_paramsFunction
get_params(lnr)

Return the value of all parameters on a learner

Julia Equivalent: IAI.get_params

Arguments

  • lnr: The learner to query.
iai::cloneFunction
clone(lnr)

Return an unfitted copy of a learner with the same parameters

Julia Equivalent: IAI.clone

Arguments

  • lnr: The learner to copy.
iai::read_jsonFunction
read_json(filename)

Read in a learner or grid saved in JSON format

Julia Equivalent: IAI.read_json

Arguments

  • filename: The location of the JSON file.
iai::write_jsonFunction
write_json(filename, obj, ...)

Output a learner or grid in JSON format

Julia Equivalent: IAI.write_json

Arguments

  • filename: Where to save the output.
  • obj: The learner or grid to output.
  • ...: Refer to the Julia documentation for available parameters.

Supervised learners

iai::predict.supervised_learnerFunction
predict(obj, X, ...)

Return the predictions made by a supervised learner for each point in the features

Julia Equivalent: IAI.predict

Arguments

  • obj: The learner or grid to use for prediction.
  • X: The features of the data.
  • ...: Refer to the Julia documentation for available parameters.
iai::score.supervised_learnerFunction
score(obj, X, ...)

Calculate the score for a model on the given data

Julia Equivalent: IAI.score

Arguments

  • obj: The learner or grid to evaluate.
  • X: The features of the data.
  • ...: Other parameters, including zero or more target vectors as required by the problem type. Refer to the Julia documentation for available parameters.

Classification learners

iai::predict_proba.classification_learnerFunction
predict_proba(obj, X, ...)

Return the probabilities of class membership predicted by a classification learner for each point in the features

Julia Equivalent: IAI.predict_proba

Arguments

  • obj: The learner or grid to use for prediction.
  • X: The features of the data.
  • ...: Additional arguments (unused)
iai::roc_curveFunction
roc_curve(obj, ...)

Generic function for constructing an ROC curve

Julia Equivalent: IAI.ROCCurve

Arguments

  • obj: The object controlling which method is used
  • ...: Arguments depending on the specific method used
iai::roc_curve.classification_learnerFunction
roc_curve(obj, X, y, ...)

Construct an ROC curve using a trained classification learner on the given data

Julia Equivalent: IAI.ROCCurve

Arguments

  • obj: The learner or grid to use for prediction.
  • X: The features of the data.
  • y: The labels of the data.
  • ...: Refer to the Julia documentation for available parameters.
iai::roc_curve.defaultFunction
roc_curve(obj, y, positive_label = stop("`positive_label` is required"), ...)

Construct an ROC curve from predicted probabilities and true labels

Julia Equivalent: IAI.ROCCurve

Arguments

  • obj: The predicted probabilities for each point in the data.
  • y: The true labels of the data.
  • positive_label: The label for which probability is being predicted.
  • ...: Additional arguments (unused)
IAI Compatibility

Requires IAI version 2.0 or higher.

iai::get_roc_curve_dataFunction
get_roc_curve_data(curve)

Extract the underlying data from an ROC curve

ROC curves are returned by roc_curve, e.g. roc_curve.classification_learner

The data is returned as a list with two keys: auc giving the area-under-the-curve, and coords containing a vector of lists representing each point on the curve, each with keys fpr (the false positive rate), tpr (the true positive rate) and threshold (the threshold).

Julia Equivalent: IAI.get_roc_curve_data

Arguments

  • curve: The curve to query.
IAI Compatibility

Requires IAI version 2.1 or higher.

plot.roc_curveFunction
plot(x, ...)

Plot an ROC curve

Arguments

  • x: The ROC curve to plot
  • ...: Additional arguments (unused)
IAI Compatibility

Requires IAI version 2.1 or higher.

ggplot2::autoplot.roc_curveFunction
ggplot2::autoplot(object, ...)

Construct a ggplot2::ggplot object plotting the ROC curve

Arguments

  • object: The ROC curve to plot
  • ...: Additional arguments (unused)
IAI Compatibility

Requires IAI version 2.1 or higher.

iai::write_html.roc_curveFunction
write_html(filename, obj, ...)

Output an ROC curve as an interactive browser visualization in HTML format

Julia Equivalent: IAI.write_html

Arguments

  • filename: Where to save the output.
  • obj: The curve to output.
  • ...: Refer to the Julia documentation for available parameters.
IAI Compatibility

Requires IAI version 1.1 or higher.

iai::show_in_browser.roc_curveFunction
show_in_browser(obj, ...)

Show interactive visualization of a roc_curve in the default browser

Julia Equivalent: IAI.show_in_browser

Arguments

  • obj: The curve to visualize.
  • ...: Refer to the Julia documentation for available parameters.
IAI Compatibility

Requires IAI version 1.1 or higher.

Survival learners

iai::predict.survival_learnerFunction
predict(obj, X, t = NULL, ...)

Return the predictions made by a survival learner for each point in the features

Julia Equivalent: IAI.predict

Arguments

  • obj: The learner or grid to use for prediction.
  • X: The features of the data.
  • t: The time for which to predict survival probability, defaulting to returning the entire survival curve if not supplied
  • ...: Additional arguments (unused)
iai::predict_hazard.survival_learnerFunction
predict_hazard(obj, X, ...)

Return the fitted hazard coefficient estimate made by a survival learner for each point in the features.

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

Julia Equivalent: IAI.predict_hazard

Arguments

  • obj: The learner or grid to use for prediction.
  • X: The features of the data.
  • ...: Additional arguments (unused)
IAI Compatibility

Requires IAI version 1.2 or higher.

iai::predict_expected_survival_time.survival_learnerFunction
predict_expected_survival_time(obj, X, ...)

Return the expected survival time estimate made by a survival learner for each point in the features.

Julia Equivalent: IAI.predict_expected_survival_time

Arguments

  • obj: The learner or grid to use for prediction.
  • X: The features of the data.
  • ...: Additional arguments (unused)
IAI Compatibility

Requires IAI version 2.0 or higher.

Prescription learners

iai::predict_outcomes.prescription_learnerFunction
predict_outcomes(obj, X, ...)

Return the predicted outcome for each treatment made by a prescription learner for each point in the features

Julia Equivalent: IAI.predict_outcomes

Arguments

  • obj: The learner or grid to use for prediction.
  • X: The features of the data.
  • ...: Additional arguments (unused)

Policy learners

iai::predict_outcomes.policy_learnerFunction
predict_outcomes(obj, X, rewards, ...)

Return the predicted outcome for each treatment made by a policy learner for each point in the features

Julia Equivalent: IAI.predict_outcomes

Arguments

  • obj: The learner or grid to use for prediction.
  • X: The features of the data.
  • rewards: The estimated reward matrix for the data.
  • ...: Additional arguments (unused)
IAI Compatibility

Requires IAI version 2.0 or higher

iai::predict_treatment_rankFunction
predict_treatment_rank(lnr, X)

Return the treatments in ranked order of effectiveness for each point in the features

Julia Equivalent: IAI.predict_treatment_rank

Arguments

  • lnr: The learner or grid to use for prediction.
  • X: The features of the data.
IAI Compatibility

Requires IAI version 2.1 or higher.

iai::predict_treatment_outcomeFunction
predict_treatment_outcome(lnr, X)

Return the estimated quality of each treatment in the trained model of the learner for each point in the features

Julia Equivalent: IAI.predict_treatment_outcome

Arguments

  • lnr: The learner or grid to use for prediction.
  • X: The features of the data.
IAI Compatibility

Requires IAI version 2.1 or higher.

Imputation learners

iai::fit.imputation_learnerFunction
fit(obj, X, ...)

Fits an imputation learner to the training data.

Additional keyword arguments are available for fitting imputation learners - please refer to the Julia documentation.

Julia Equivalent: IAI.fit!

Arguments

  • obj: The learner or grid to fit.
  • X: The features of the data.
  • ...: Refer to the Julia documentation for available parameters.
iai::fit_transformFunction
fit_transform(lnr, X, ...)

Fit an imputation model using the given features and impute the missing values in these features

Similar to calling fit.imputation_learner followed by transform

Julia Equivalent: IAI.fit_transform!

Arguments

  • lnr: The learner or grid to use for imputation
  • X: The features of the data.
  • ...: Refer to the Julia documentation for available parameters.
iai::transformFunction
transform(lnr, X)

Impute missing values in a dataframe using a fitted imputation model

Julia Equivalent: IAI.transform

Arguments

  • lnr: The learner or grid to use for imputation
  • X: The features of the data.

Visualization

iai::write_html.abstract_visualizationFunction
write_html(filename, obj, ...)

Output an object as an interactive browser visualization in HTML format

Julia Equivalent: IAI.write_html

Arguments

  • filename: Where to save the output.
  • obj: The object to output.
  • ...: Refer to the Julia documentation for available parameters.
iai::questionnaireFunction
questionnaire(obj, ...)

Generic function for constructing an interactive questionnaire

Julia Equivalent: IAI.Questionnaire

Arguments

  • obj: The object controlling which method is used
  • ...: Arguments depending on the specific method used
iai::multi_questionnaire.grid_searchFunction
multi_questionnaire(obj, ...)

Construct an interactive tree questionnaire using multiple learners from the results of a grid search

Julia Equivalent: IAI.MultiQuestionnaire

Arguments

  • obj: The grid to visualize
  • ...: Additional arguments (unused)
IAI Compatibility

Requires IAI version 2.0 or higher.

Grid Search

iai::grid_searchFunction
grid_search(lnr, ...)

Controls grid search over parameter combinations

Julia Equivalent: IAI.GridSearch

Arguments

  • lnr: The learner to use when validating.
  • ...: The parameters to validate over.
iai::fit.grid_searchFunction
fit(obj, X, ...)

Fits a grid_search to the training data

Julia Equivalent: IAI.fit!

Arguments

  • obj: The grid search to fit.
  • X: The features of the data.
  • ...: Other parameters, including zero or more target vectors as required by the problem type. Refer to the Julia documentation for available parameters.
iai::fit_cvFunction
fit_cv(grid, X, ...)

Fits a grid search to the training data with cross-validation

Julia Equivalent: IAI.fit_cv!

Arguments

  • grid: The grid to fit.
  • X: The features of the data.
  • ...: Other parameters, including zero or more target vectors as required by the problem type. Refer to the Julia documentation for available parameters.
iai::fit_transform_cvFunction
fit_transform_cv(grid, X, ...)

Train a grid using cross-validation with features and impute all missing values in these features

Julia Equivalent: IAI.fit_transform_cv!

Arguments

  • grid: The grid to use for imputation
  • X: The features of the data.
  • ...: Refer to the Julia documentation for available parameters.
iai::get_learnerFunction
get_learner(grid)

Return the fitted learner using the best parameter combination from a grid

Julia Equivalent: IAI.get_learner

Arguments

  • grid: The grid to query.

Tree Learners

General tree learners

iai::applyFunction
apply(lnr, X)

Return the leaf index in a tree model into which each point in the features falls

Julia Equivalent: IAI.apply

Arguments

  • lnr: The learner or grid to query.
  • X: The features of the data.
iai::apply_nodesFunction
apply_nodes(lnr, X)

Return the indices of the points in the features that fall into each node of a trained tree model

Julia Equivalent: IAI.apply_nodes

Arguments

  • lnr: The learner or grid to query.
  • X: The features of the data.
iai::decision_pathFunction
decision_path(lnr, X)

Return a matrix where entry (i, j) is true if the ith point in the features passes through the jth node in a trained tree model.

Julia Equivalent: IAI.decision_path

Arguments

  • lnr: The learner or grid to query.
  • X: The features of the data.
iai::print_pathFunction
print_path(lnr, X, ...)

Print the decision path through the learner for each sample in the features

Julia Equivalent: IAI.print_path

Arguments

  • lnr: The learner or grid to query.
  • X: The features of the data.
  • ...: Refer to the Julia documentation for available parameters.
iai::variable_importance.tree_learnerFunction
variable_importance(obj, ...)

Generate a ranking of the variables in a tree learner according to their importance during training. The results are normalized so that they sum to one.

Julia Equivalent: IAI.variable_importance

Arguments

  • obj: The learner to query.
  • ...: Refer to the Julia documentation for available parameters.
iai::get_depthFunction
get_depth(lnr, node_index)

Get the depth of a node of a tree

Julia Equivalent: IAI.get_depth

Arguments

  • lnr: The learner to query.
  • node_index: The node in the tree to query.
iai::get_parentFunction
get_parent(lnr, node_index)

Get the index of the parent node at a node of a tree

Julia Equivalent: IAI.get_parent

Arguments

  • lnr: The learner to query.
  • node_index: The node in the tree to query.
iai::get_lower_childFunction
get_lower_child(lnr, node_index)

Get the index of the lower child at a split node of a tree

Julia Equivalent: IAI.get_lower_child

Arguments

  • lnr: The learner to query.
  • node_index: The node in the tree to query.
iai::get_upper_childFunction
get_upper_child(lnr, node_index)

Get the index of the upper child at a split node of a tree

Julia Equivalent: IAI.get_upper_child

Arguments

  • lnr: The learner to query.
  • node_index: The node in the tree to query.
iai::get_num_samplesFunction
get_num_samples(lnr, node_index)

Get the number of training points contained in a node of a tree

Julia Equivalent: IAI.get_num_samples

Arguments

  • lnr: The learner to query.
  • node_index: The node in the tree to query.
iai::is_categoric_splitFunction
is_categoric_split(lnr, node_index)

Check if a node of a tree applies a categoric split

Julia Equivalent: IAI.is_categoric_split

Arguments

  • lnr: The learner to query.
  • node_index: The node in the tree to query.
iai::is_hyperplane_splitFunction
is_hyperplane_split(lnr, node_index)

Check if a node of a tree applies a hyperplane split

Julia Equivalent: IAI.is_hyperplane_split

Arguments

  • lnr: The learner to query.
  • node_index: The node in the tree to query.
iai::is_leafFunction
is_leaf(lnr, node_index)

Check if a node of a tree is a leaf

Julia Equivalent: IAI.is_leaf

Arguments

  • lnr: The learner to query.
  • node_index: The node in the tree to query.
iai::is_mixed_ordinal_splitFunction
is_mixed_ordinal_split(lnr, node_index)

Check if a node of a tree applies a mixed ordinal/categoric split

Julia Equivalent: IAI.is_mixed_ordinal_split

Arguments

  • lnr: The learner to query.
  • node_index: The node in the tree to query.
iai::is_ordinal_splitFunction
is_ordinal_split(lnr, node_index)

Check if a node of a tree applies a ordinal split

Julia Equivalent: IAI.is_ordinal_split

Arguments

  • lnr: The learner to query.
  • node_index: The node in the tree to query.
iai::is_parallel_splitFunction
is_parallel_split(lnr, node_index)

Check if a node of a tree applies a parallel split

Julia Equivalent: IAI.is_parallel_split

Arguments

  • lnr: The learner to query.
  • node_index: The node in the tree to query.
iai::get_split_categoriesFunction
get_split_categories(lnr, node_index)

Return the categoric/ordinal information used in the split at a node of a tree

Julia Equivalent: IAI.get_split_categories

Arguments

  • lnr: The learner to query.
  • node_index: The node in the tree to query.
iai::get_split_featureFunction
get_split_feature(lnr, node_index)

Return the feature used in the split at a node of a tree

Julia Equivalent: IAI.get_split_feature

Arguments

  • lnr: The learner to query.
  • node_index: The node in the tree to query.
iai::get_split_thresholdFunction
get_split_threshold(lnr, node_index)

Return the threshold used in the split at a node of a tree

Julia Equivalent: IAI.get_split_threshold

Arguments

  • lnr: The learner to query.
  • node_index: The node in the tree to query.
iai::get_split_weightsFunction
get_split_weights(lnr, node_index)

Return the weights for numeric and categoric features used in the hyperplane split at a node of a tree

Julia Equivalent: IAI.get_split_weights

Arguments

  • lnr: The learner to query.
  • node_index: The node in the tree to query.
iai::missing_goes_lowerFunction
missing_goes_lower(lnr, node_index)

Check if points with missing values go to the lower child at a split node of of a tree

Julia Equivalent: IAI.missing_goes_lower

Arguments

  • lnr: The learner to query.
  • node_index: The node in the tree to query.

Classification tree learners

iai::set_thresholdFunction
set_threshold(lnr, label, threshold, ...)

For a binary classification problem, update the the predicted labels in the leaves of the learner to predict a label only if the predicted probability is at least the specified threshold.

Julia Equivalent: IAI.set_threshold!

Arguments

  • lnr: The learner to modify.
  • label: The referenced label.
  • threshold: The probability threshold above which label will be be predicted.
  • ...: Refer to the Julia documentation for available parameters.
iai::set_display_labelFunction
set_display_label(lnr, display_label)

Show the probability of a specified label when visualizing a learner

Julia Equivalent: IAI.set_display_label!

Arguments

  • lnr: The learner to modify.
  • display_label: The label for which to show probabilities.
iai::reset_display_labelFunction
reset_display_label(lnr)

Reset the predicted probability displayed to be that of the predicted label when visualizing a learner

Julia Equivalent: IAI.reset_display_label!

Arguments

  • lnr: The learner to modify.

Regression tree learners

iai::get_regression_weights.regression_tree_learnerFunction
get_regression_weights(obj, node_index, ...)

Return the weights for each feature in the linear regression prediction at a node of a regression tree

Julia Equivalent: IAI.get_regression_weights

Arguments

  • obj: The learner to query.
  • node_index: The node in the tree to query.
  • ...: Refer to the Julia documentation for available parameters.

Survival tree learners

iai::get_survival_curveFunction
get_survival_curve(lnr, node_index, ...)

Return the survival curve at a node of a tree

Julia Equivalent: IAI.get_survival_curve

Arguments

  • lnr: The learner to query.
  • node_index: The node in the tree to query.
  • ...: Refer to the Julia documentation for available parameters.
iai::get_survival_expected_timeFunction
get_survival_expected_time(lnr, node_index, ...)

Return the predicted expected survival time at a node of a tree

Julia Equivalent: IAI.get_survival_expected_time

Arguments

  • lnr: The learner to query.
  • node_index: The node in the tree to query.
  • ...: Refer to the Julia documentation for available parameters.
IAI Compatibility

Requires IAI version 2.1 or higher.

iai::get_survival_hazardFunction
get_survival_hazard(lnr, node_index, ...)

Return the predicted hazard ratio at a node of a tree

Julia Equivalent: IAI.get_survival_hazard

Arguments

  • lnr: The learner to query.
  • node_index: The node in the tree to query.
  • ...: Refer to the Julia documentation for available parameters.
IAI Compatibility

Requires IAI version 2.1 or higher.

Prescription tree learners

iai::get_prescription_treatment_rankFunction
get_prescription_treatment_rank(lnr, node_index, ...)

Return the treatments ordered from most effective to least effective at a node of a tree

Julia Equivalent: IAI.get_prescription_treatment_rank

Arguments

  • lnr: The learner to query.
  • node_index: The node in the tree to query.
  • ...: Refer to the Julia documentation for available parameters.
iai::get_regression_constant.prescription_tree_learnerFunction
get_regression_constant(obj, node_index, treatment, ...)

Return the constant term in the linear regression prediction at a node of a prescription tree

Julia Equivalent: IAI.get_regression_constant

Arguments

  • obj: The learner to query.
  • node_index: The node in the tree to query.
  • treatment: The treatment to query.
  • ...: Refer to the Julia documentation for available parameters.
iai::get_regression_weights.prescription_tree_learnerFunction
get_regression_weights(obj, node_index, treatment, ...)

Return the weights for each feature in the linear regression prediction at a node of a prescription tree

Julia Equivalent: IAI.get_regression_weights

Arguments

  • obj: The learner to query.
  • node_index: The node in the tree to query.
  • treatment: The treatment to query.
  • ...: Refer to the Julia documentation for available parameters.

Policy tree learners

iai::get_policy_treatment_rankFunction
get_policy_treatment_rank(lnr, node_index, ...)

Return the treatments ordered from most effective to least effective at a node of a tree

Julia Equivalent: IAI.get_policy_treatment_rank

Arguments

  • lnr: The learner to query.
  • node_index: The node in the tree to query.
  • ...: Refer to the Julia documentation for available parameters.
IAI Compatibility

Requires IAI version 2.0 or higher.

iai::get_policy_treatment_outcomeFunction
get_policy_treatment_outcome(lnr, node_index, ...)

Return the quality of the treatments at a node of a tree

Julia Equivalent: IAI.get_policy_treatment_outcome

Arguments

  • lnr: The learner to query.
  • node_index: The node in the tree to query.
  • ...: Refer to the Julia documentation for available parameters.
IAI Compatibility

Requires IAI version 2.1 or higher.

Tree learner visualization

iai::write_pngFunction
write_png(filename, lnr, ...)

Output a learner 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

Arguments

  • filename: Where to save the output.
  • lnr: The learner to output.
  • ...: Refer to the Julia documentation for available parameters.
iai::write_pdfFunction
write_pdf(filename, lnr, ...)

Output a learner 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

Arguments

  • filename: Where to save the output.
  • lnr: The learner to output.
  • ...: Refer to the Julia documentation for available parameters.
IAI Compatibility

Requires IAI version 2.1 or higher.

iai::write_svgFunction
write_svg(filename, lnr, ...)

Output a learner as a 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

Arguments

  • filename: Where to save the output.
  • lnr: The learner to output.
  • ...: Refer to the Julia documentation for available parameters.
IAI Compatibility

Requires IAI version 2.1 or higher.

iai::write_dotFunction
write_dot(filename, lnr, ...)

Output a learner in .dot format

Julia Equivalent: IAI.write_dot

Arguments

  • filename: Where to save the output.
  • lnr: The learner to output.
  • ...: Refer to the Julia documentation for available parameters.
iai::write_html.tree_learnerFunction
write_html(filename, obj, ...)

Output a tree learner as an interactive browser visualization in HTML format

Julia Equivalent: IAI.write_html

Arguments

  • filename: Where to save the output.
  • obj: The learner or grid to output.
  • ...: Refer to the Julia documentation for available parameters.
IAI Compatibility

Outputting a grid search requires IAI version 2.0 or higher.

iai::show_in_browser.tree_learnerFunction
show_in_browser(obj, ...)

Show interactive tree visualization of a tree learner in the default browser

Julia Equivalent: IAI.show_in_browser

Arguments

  • obj: The learner or grid to visualize.
  • ...: Refer to the Julia documentation for available parameters.
IAI Compatibility

Showing a grid search requires IAI version 2.0 or higher.

iai::write_questionnaire.tree_learnerFunction
write_questionnaire(filename, obj, ...)

Output a tree learner as an interactive questionnaire in HTML format

Julia Equivalent: IAI.write_questionnaire

Arguments

  • filename: Where to save the output.
  • obj: The learner or grid to output.
  • ...: Refer to the Julia documentation for available parameters.
IAI Compatibility

Outputting a grid search requires IAI version 2.0 or higher.

iai::show_questionnaire.tree_learnerFunction
show_questionnaire(obj, ...)

Show an interactive questionnaire based on a tree learner in default browser

Julia Equivalent: IAI.show_questionnaire

Arguments

  • obj: The learner or grid to visualize.
  • ...: Refer to the Julia documentation for available parameters.
IAI Compatibility

Showing a grid search requires IAI version 2.0 or higher.

iai::multi_tree_plot.grid_searchFunction
multi_tree_plot(obj, ...)

Construct an interactive tree visualization of multiple tree learners from the results of a grid search

Julia Equivalent: IAI.MultiTreePlot

Arguments

  • obj: The grid to visualize
  • ...: Additional arguments (unused)
IAI Compatibility

Requires IAI version 2.0 or higher.

Optimal Trees

iai::optimal_tree_classifierFunction
optimal_tree_classifier(...)

Learner for training Optimal Classification Trees

Julia Equivalent: IAI.OptimalTreeClassifier

Arguments

  • ...: Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
iai::optimal_tree_regressorFunction
optimal_tree_regressor(...)

Learner for training Optimal Regression Trees

Julia Equivalent: IAI.OptimalTreeRegressor

Arguments

  • ...: Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
iai::optimal_tree_prescription_minimizerFunction
optimal_tree_prescription_minimizer(...)

Learner for training Optimal Prescriptive Trees where the prescriptions should aim to minimize outcomes

Julia Equivalent: IAI.OptimalTreePrescriptionMinimizer

Arguments

  • ...: Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
iai::optimal_tree_prescription_maximizerFunction
optimal_tree_prescription_maximizer(...)

Learner for training Optimal Prescriptive Trees where the prescriptions should aim to maximize outcomes

Julia Equivalent: IAI.OptimalTreePrescriptionMaximizer

Arguments

  • ...: Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
iai::optimal_tree_policy_minimizerFunction
optimal_tree_policy_minimizer(...)

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

Julia Equivalent: IAI.OptimalTreePolicyMinimizer

Arguments

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

Requires IAI version 2.0 or higher.

iai::optimal_tree_policy_maximizerFunction
optimal_tree_policy_maximizer(...)

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

Julia Equivalent: IAI.OptimalTreePolicyMaximizer

Arguments

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

Requires IAI version 2.0 or higher.

OptImpute

iai::imputeFunction
impute(X, ...)

Impute missing values using either a specified method or through validation

Julia Equivalent: IAI.impute

This function was deprecated in iai 1.7.0. This is for consistency with the IAI v3.0.0 Julia release.

Arguments

  • X: The dataframe in which to impute missing values.
  • ...: Refer to the Julia documentation for available parameters.
iai::impute_cvFunction
impute_cv(X, ...)

Impute missing values using cross validation

Julia Equivalent: IAI.impute_cv

This function was deprecated in iai 1.7.0. This is for consistency with the IAI v3.0.0 Julia release.

Arguments

  • X: The dataframe in which to impute missing values.
  • ...: Refer to the Julia documentation for available parameters.
iai::imputation_learnerFunction
imputation_learner(method = "opt_knn", ...)

Generic learner for imputing missing values

Julia Equivalent: IAI.ImputationLearner

Arguments

  • method: (optional) Specifies the imputation method to use.
  • ...: Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
iai::opt_knn_imputation_learnerFunction
opt_knn_imputation_learner(...)

Learner for conducting optimal k-NN imputation

Julia Equivalent: IAI.OptKNNImputationLearner

Arguments

  • ...: Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
iai::opt_svm_imputation_learnerFunction
opt_svm_imputation_learner(...)

Learner for conducting optimal SVM imputation

Julia Equivalent: IAI.OptSVMImputationLearner

Arguments

  • ...: Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
iai::opt_tree_imputation_learnerFunction
opt_tree_imputation_learner(...)

Learner for conducting optimal tree-based imputation

Julia Equivalent: IAI.OptTreeImputationLearner

Arguments

  • ...: Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
iai::mean_imputation_learnerFunction
mean_imputation_learner(...)

Learner for conducting mean imputation

Julia Equivalent: IAI.MeanImputationLearner

Arguments

  • ...: Use keyword arguments to set parameters on the resulting learner. Refer to the Julia documentation for available parameters.
iai::rand_imputation_learnerFunction
rand_imputation_learner(...)

Learner for conducting random imputation

Julia Equivalent: IAI.RandImputationLearner

Arguments

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

Optimal Feature Selection

iai::optimal_feature_selection_classifierFunction
optimal_feature_selection_classifier(...)

Learner for conducting Optimal Feature Selection on classification problems

Julia Equivalent: IAI.OptimalFeatureSelectionClassifier

Arguments

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

Requires IAI version 1.1 or higher.

iai::optimal_feature_selection_regressorFunction
optimal_feature_selection_regressor(...)

Learner for conducting Optimal Feature Selection on regression problems

Julia Equivalent: IAI.OptimalFeatureSelectionRegressor

Arguments

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

Requires IAI version 1.1 or higher.

iai::fit.optimal_feature_selection_learnerFunction
fit(obj, X, ...)

Fits an Optimal Feature Selection learner to the training data

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!

Arguments

  • obj: The learner or grid to fit.
  • X: The features of the data.
  • ...: Other parameters, including zero or more target vectors as required by the problem type. Refer to the Julia documentation for available parameters.
IAI Compatibility

Requires IAI version 1.1 or higher.

iai::predict.optimal_feature_selection_learnerFunction
predict(obj, X, fit_index = NULL, ...)

Return the predictions made by an Optimal Feature Selection learner for each point in the features

Julia Equivalent: IAI.predict

Arguments

  • obj: The learner or grid to use for prediction.
  • X: The features of the data.
  • fit_index: The index of the cluster to use for prediction, if the coordinated_sparsity parameter on the learner is TRUE.
  • ...: Refer to the Julia documentation for available parameters.
IAI Compatibility

Requires IAI version 1.1 or higher.

iai::score.optimal_feature_selection_learnerFunction
score(obj, X, ...)

Calculate the score for an Optimal Feature Selection learner on the given data

Julia Equivalent: IAI.score

Arguments

  • obj: The learner or grid to evaluate.
  • X: The features of the data.
  • ...: Other parameters, including zero or more target vectors as required by the problem type. If the coordinated_sparsity parameter on the learner is TRUE, then fit_index must be used to specify which cluster should be used. Refer to the Julia documentation for available parameters.
IAI Compatibility

Requires IAI version 1.1 or higher.

iai::variable_importance.optimal_feature_selection_learnerFunction
variable_importance(obj, fit_index = NULL, ...)

Generate a ranking of the variables in an Optimal Feature Selection learner according to their importance during training. The results are normalized so that they sum to one.

Julia Equivalent: IAI.variable_importance

Arguments

  • obj: The learner to query.
  • fit_index: The index of the cluster to use for prediction, if the coordinated_sparsity parameter on the learner is TRUE.
  • ...: Refer to the Julia documentation for available parameters.
IAI Compatibility

Requires IAI version 1.1 or higher.

iai::get_prediction_constant.optimal_feature_selection_learnerFunction
get_prediction_constant(obj, fit_index = NULL, ...)

Return the constant term in the prediction in a trained Optimal Feature Selection learner

Julia Equivalent: IAI.get_prediction_constant

Arguments

  • obj: The learner to query.
  • fit_index: The index of the cluster to use for prediction, if the coordinated_sparsity parameter on the learner is TRUE.
  • ...: Additional arguments (unused)
IAI Compatibility

Requires IAI version 1.1 or higher.

iai::get_prediction_weights.optimal_feature_selection_learnerFunction
get_prediction_weights(obj, fit_index = NULL, ...)

Return the weights for numeric and categoric features used for prediction in a trained Optimal Feature Selection learner

Julia Equivalent: IAI.get_prediction_weights

Arguments

  • obj: The learner to query.
  • fit_index: The index of the cluster to use for prediction, if the coordinated_sparsity parameter on the learner is TRUE.
  • ...: Additional arguments (unused)
IAI Compatibility

Requires IAI version 1.1 or higher.

iai::write_questionnaire.optimal_feature_selection_learnerFunction
write_questionnaire(filename, obj, ...)

Output an Optimal Feature Selection learner as an interactive questionnaire in HTML format

Julia Equivalent: IAI.write_questionnaire

Arguments

  • filename: Where to save the output.
  • obj: The learner or grid to output.
  • ...: Refer to the Julia documentation for available parameters.
IAI Compatibility

Requires IAI version 2.1 or higher.

iai::show_questionnaire.optimal_feature_selection_learnerFunction
show_questionnaire(obj, ...)

Show an interactive questionnaire based on an Optimal Feature Selection learner in default browser

Julia Equivalent: IAI.show_questionnaire

Arguments

  • obj: The learner or grid to visualize.
  • ...: Refer to the Julia documentation for available parameters.
IAI Compatibility

Requires IAI version 2.1 or higher.

Reward Estimation

iai::fit_predictFunction
fit_predict(obj, ...)

Generic function for fitting a reward estimator on features, treatments and returning predicted counterfactual rewards and scores of the internal estimators.

Julia Equivalent: IAI.fit_predict!

Arguments

  • obj: The object controlling which method is used
  • ...: Arguments depending on the specific method used

Categorical Treatments

iai::categorical_reward_estimatorFunction
categorical_reward_estimator(...)

Learner for conducting reward estimation with categorical treatments

This function was deprecated in iai 1.6.0, and [categoricalclassificationrewardestimator()] or [categoricalclassificationrewardestimator()] should be used instead.

This deprecation is no longer supported as of the IAI v3 release.

Arguments

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

Requires IAI version 2.0, 2.1 or 2.2.

iai::fit_predict.categorical_reward_estimatorFunction
fit_predict(obj, X, treatments, ...)

Fit a categorical reward estimator on features, treatments and outcomes and return predicted counterfactual rewards for each observation, under each treatment observed in the data, as well as the scores of the internal estimators.

Julia Equivalent: IAI.fit_predict!

Arguments

  • obj: The learner or grid to use for estimation
  • X: The features of the data.
  • treatments: The treatment applied to each point in the data.
  • ...: Additional arguments depending on the treatment and outcome types. Refer to the Julia documentation for more information.
IAI Compatibility

Requires IAI version 2.0 or higher.

iai::predict.categorical_reward_estimatorFunction
predict(obj, X, ...)

Return counterfactual rewards estimated by a categorical reward estimator for each observation in the supplied data

Julia Equivalent: IAI.predict

Arguments

  • obj: The learner or grid to use for estimation
  • X: The features of the data.
  • ...: Additional arguments depending on the treatment and outcome types. Refer to the Julia documentation for more information.
IAI Compatibility

Requires IAI version 2.0 or higher.

iai::score.categorical_reward_estimatorFunction
score(obj, X, ...)

Calculate the scores for a categorical reward estimator on the given data

Julia Equivalent: IAI.score

Arguments

  • obj: The learner or grid to evaluate.
  • X: The features of the data.
  • ...: Other parameters, including zero or more target vectors as required by the problem type. Refer to the Julia documentation for other available parameters.
IAI Compatibility

Requires IAI version 2.1 or higher.

iai::equal_propensity_estimatorFunction
equal_propensity_estimator(...)

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

Arguments

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

Requires IAI version 2.1 or higher.

Numeric Treatments

iai::numeric_reward_estimatorFunction
numeric_reward_estimator(...)

Learner for conducting reward estimation with numeric treatments

This function was deprecated in iai 1.6.0, and [numericclassificationrewardestimator()] or [numericclassificationrewardestimator()] should be used instead.

This deprecation is no longer supported as of the IAI v3 release.

Arguments

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

Requires IAI version 2.1 or 2.2.

iai::fit_predict.numeric_reward_estimatorFunction
fit_predict(obj, X, treatments, ...)

Fit a numeric reward estimator on features, treatments and outcomes and return predicted counterfactual rewards for each observation, under each treatment candidate, as well as the scores of the internal estimators.

Julia Equivalent: IAI.fit_predict!

Arguments

  • obj: The learner or grid to use for estimation
  • X: The features of the data.
  • treatments: The treatment applied to each point in the data.
  • ...: Additional arguments depending on the treatment and outcome types. Refer to the Julia documentation for more information.
IAI Compatibility

Requires IAI version 2.1 or higher.

iai::predict.numeric_reward_estimatorFunction
predict(obj, X, ...)

Return counterfactual rewards estimated by a numeric reward estimator for each observation in the supplied data

Julia Equivalent: IAI.predict

Arguments

  • obj: The learner or grid to use for estimation
  • X: The features of the data.
  • ...: Additional arguments depending on the treatment and outcome types. Refer to the Julia documentation for more information.
IAI Compatibility

Requires IAI version 2.1 or higher.

iai::score.numeric_reward_estimatorFunction
score(obj, X, ...)

Calculate the scores for a numeric reward estimator on the given data

Julia Equivalent: IAI.score

Arguments

  • obj: The learner or grid to evaluate.
  • X: The features of the data.
  • ...: Other parameters, including zero or more target vectors as required by the problem type. Refer to the Julia documentation for other available parameters.
IAI Compatibility

Requires IAI version 2.1 or higher.

iai::all_treatment_combinationsFunction
all_treatment_combinations(...)

Return a 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

Arguments

  • ...: A vector of possible options for each treatment

Heuristics

Random Forests

iai::random_forest_classifierFunction
random_forest_classifier(...)

Learner for training random forests for classification problems

Julia Equivalent: IAI.RandomForestClassifier

Arguments

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

Requires IAI version 2.1 or higher.

iai::random_forest_regressorFunction
random_forest_regressor(...)

Learner for training random forests for regression problems

Julia Equivalent: IAI.RandomForestRegressor

Arguments

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

Requires IAI version 2.1 or higher.

XGBoost

iai::xgboost_classifierFunction
xgboost_classifier(...)

Learner for training XGBoost models for classification problems

Julia Equivalent: IAI.XGBoostClassifier

Arguments

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

Requires IAI version 2.1 or higher.

iai::xgboost_regressorFunction
xgboost_regressor(...)

Learner for training XGBoost models for regression problems

Julia Equivalent: IAI.XGBoostRegressor

Arguments

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

Requires IAI version 2.1 or higher.

iai::write_boosterFunction
write_booster(filename, lnr)

Write the internal booster saved in the learner to file

Julia Equivalent: IAI.write_booster

Arguments

  • filename: Where to save the output.
  • lnr: The XGBoost learner with the booster to output.
IAI Compatibility

Requires IAI version 2.1 or higher.

GLMNet

iai::glmnetcv_regressorFunction
glmnetcv_regressor(...)

Learner for training GLMNet models for regression problems with cross-validation

Julia Equivalent: IAI.GLMNetCVRegressor

Arguments

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

Requires IAI version 2.1 or higher.

iai::predict.glmnetcv_learnerFunction
predict(obj, X, fit_index = NULL, ...)

Return the predictions made by a GLMNet learner for each point in the features

Julia Equivalent: IAI.predict

Arguments

  • obj: The learner or grid to use for prediction.
  • X: The features of the data.
  • fit_index: The index of the fit in the path to use for prediction, defaulting to the best fit if not supplied.
  • ...: Refer to the Julia documentation for available parameters.
IAI Compatibility

Requires IAI version 2.1 or higher.

iai::score.glmnetcv_learnerFunction
score(obj, X, ...)

Calculate the score for a GLMNet learner on the given data

Julia Equivalent: IAI.score

Arguments

  • obj: The learner or grid to evaluate.
  • X: The features of the data.
  • ...: Other parameters, including zero or more target vectors as required by the problem type. fit_index can be used to specify the index of the fit in the path to use for prediction, defaulting to the best fit if not supplied. Refer to the Julia documentation for other available parameters.
IAI Compatibility

Requires IAI version 2.1 or higher.

iai::get_prediction_constant.glmnetcv_learnerFunction
get_prediction_constant(obj, fit_index = NULL, ...)

Return the constant term in the prediction in a trained GLMNet learner

Julia Equivalent: IAI.get_prediction_constant

Arguments

  • obj: The learner to query.
  • fit_index: The index of the fit in the path to use for prediction, defaulting to the best fit if not supplied.
  • ...: Additional arguments (unused)
IAI Compatibility

Requires IAI version 2.1 or higher.

iai::get_prediction_weights.glmnetcv_learnerFunction
get_prediction_weights(obj, fit_index = NULL, ...)

Return the weights for numeric and categoric features used for prediction in a trained GLMNet learner

Julia Equivalent: IAI.get_prediction_weights

Arguments

  • obj: The learner to query.
  • fit_index: The index of the fit in the path to use for prediction, defaulting to the best fit if not supplied.
  • ...: Additional arguments (unused)
IAI Compatibility

Requires IAI version 2.1 or higher.

iai::get_num_fits.glmnetcv_learnerFunction
get_num_fits(obj, ...)

Return the number of fits along the path in a trained GLMNet learner

Julia Equivalent: IAI.get_num_fits

Arguments

  • obj: The GLMNet learner to query.
  • ...: Additional arguments (unused)
IAI Compatibility

Requires IAI version 2.1 or higher.