API Reference
Documentation for the Heuristics
public interface.
Index
IAI.GLMNetCVClassifier
IAI.GLMNetCVLearner
IAI.GLMNetCVRegressor
IAI.GLMNetCVSurvivalLearner
IAI.GLMNetLearner
IAI.RandomForestClassifier
IAI.RandomForestLearner
IAI.RandomForestRegressor
IAI.RandomForestSurvivalLearner
IAI.XGBoostClassifier
IAI.XGBoostLearner
IAI.XGBoostRegressor
IAI.XGBoostSurvivalLearner
IAI.ROCCurve
IAI.predict_shap
IAI.write_booster
IAI.predict
IAI.predict_expected_survival_time
IAI.predict_hazard
IAI.predict_proba
IAI.score
IAI.get_num_fits
IAI.get_prediction_constant
IAI.get_prediction_weights
Random Forest
IAI.RandomForestLearner
— TypeAbstract type encompassing all random forest learners.
IAI.RandomForestClassifier
— TypeLearner for training random forests for classification problems.
The following parameters are supported (refer to the documentation for each):
IAI.RandomForestRegressor
— TypeLearner for training random forests for regression problems.
The following parameters are supported (refer to the documentation for each):
IAI.RandomForestSurvivalLearner
— TypeLearner for training random forests for survival problems.
The following parameters are supported (refer to the documentation for each):
XGBoost
IAI.XGBoostLearner
— TypeAbstract type encompassing all XGBoost learners.
IAI.XGBoostClassifier
— TypeLearner for training XGBoost models for classification problems.
The following parameters are supported (refer to the documentation for each):
IAI.XGBoostRegressor
— TypeLearner for training XGBoost models for regression problems.
The following parameters are supported (refer to the documentation for each):
IAI.XGBoostSurvivalLearner
— TypeLearner for training XGBoost models for survival problems.
The following parameters are supported (refer to the documentation for each):
IAI.predict_shap
— Functionpredict_shap(lnr::XGBoostLearner, X::FeatureInput)
Calculate SHAP values for all points in the features X
using lnr
.
Returns a Dict
with the following keys:
:shap_values
: AMatrix
of SHAP values for each sample and feature inX
. For classification problems, this key contains aVector
of such matrices, one for each target label.:expected_value
: AFloat64
containing the expected value for use in SHAP analysis. For classification problems, this key contains aVector
of such values, one for each target label.:features
: ADataFrame
containing the featuresX
in the appropriate format to pass to SHAP visualization functions.:labels
: AVector
giving the order of the target labels in the problem, corresponding to the order of the results in:shap_values
and:expected_value
(for classification problems only)
These calculations are analogous to the following Python code:
import shap
explainer = shap.TreeExplainer(lnr)
shap_values = explainer.shap_values(X)
expected_value = explainer.expected_value
IAI.write_booster
— Functionwrite_booster(filepath, lnr::XGBoostLearner)
Write the internal booster saved in lnr
to filepath
.
This can be used to open the trained XGBoost model using the XGBoost Python wrapper in order to conduct a SHAP analysis.
If filepath
ends in ".json"
the booster will be written in JSON format, otherwise an internal XGBoost binary format is used.
This output file cannot be loaded back into the IAI interface. Use write_json
to save the entire learner if you want to be able to read it back in future.
GLMNet
IAI.GLMNetLearner
— TypeAbstract type encompassing all GLMNet learners
IAI.GLMNetCVLearner
— TypeAbstract type encompassing all GLMNet learners with cross-validation.
IAI.get_num_fits
— Methodget_num_fits(lnr::GLMNetCVLearner)
Returns the number of fits along the path in lnr
.
IAI.predict
— Methodpredict(lnr::GLMNetCVLearner, X::FeatureInput)
Returns the prediction made by the best fit on the path for lnr
for each point in the data X
.
predict(lnr::GLMNetCVLearner, X::FeatureInput; fit_index::Integer)
Returns the prediction made by the fit at fit_index
on the path for lnr
for each point in the data X
.
IAI.score
— Methodscore(lnr::GLMNetCVLearner, X::FeatureInput, y::TargetInput...;
keyword_arguments...)
Calculates the score for the best fit on the path for lnr
on data X
and y
.
score(lnr::GLMNetCVLearner, X::FeatureInput, y::TargetInput...;
fit_index::Integer, keyword_arguments...)
Calculates the score for the fit at fit_index
on the path for lnr
on data X
and y
.
IAI.get_prediction_weights
— Methodget_prediction_weights(lnr::GLMNetCVLearner)
Return the weights for each feature in the prediction made by the best fit on the path in lnr
.
get_prediction_weights(lnr::GLMNetCVLearner; fit_index::Integer)
Return the weights for each feature in the prediction made by the fit at fit_index
on the path in lnr
.
IAI.get_prediction_constant
— Methodget_prediction_constant(lnr::GLMNetCVLearner)
Return the constant term in the prediction made by the best fit on the path in lnr
.
get_prediction_constant(lnr::GLMNetCVLearner; fit_index::Integer)
Return the constant term in the prediction made by the fit at fit_index
on the path in lnr
.
IAI.GLMNetCVClassifier
— TypeLearner for training GLMNet models for regression problems with cross-validation.
The following parameters are supported (refer to the documentation for each):
IAI.predict_proba
— Methodpredict_proba(lnr::GLMNetCVClassifier, X::FeatureInput)
Returns the probabilities of class membership predicted by the best fit on the path for lnr
for each point in the data X
.
predict_proba(lnr::GLMNetCVClassifier, X::FeatureInput; fit_index::Integer)
Returns the probabilities of class membership predicted by the fit at fit_index
on the path for lnr
for each point in the data X
.
IAI.ROCCurve
— MethodROCCurve(lnr::GLMNetCVClassifier, X::FeatureInput, y::AbstractVector;
positive_label)
Construct a ROCCurve
using the best fit on the path for lnr
on the features X
and labels y
, treating positive_label
as the positive label.
ROCCurve(lnr::GLMNetCVClassifier, X::FeatureInput, y::AbstractVector;
positive_label, fit_index::Integer)
Construct a ROCCurve
using the fit at fit_index
on the path for lnr
on the features X
and labels y
, treating positive_label
as the positive label.
IAI.GLMNetCVRegressor
— TypeLearner for training GLMNet models for regression problems with cross-validation.
The following parameters are supported (refer to the documentation for each):
IAI.GLMNetCVSurvivalLearner
— TypeLearner for training GLMNetCV models for survival problems.
The following parameters are supported (refer to the documentation for each):
IAI.predict_hazard
— Methodpredict_hazard(lnr::GLMNetCVSurvivalLearner, X::FeatureInput)
Returns the fitted hazard coefficient estimate made by the best fit on the path for lnr
for each point in the data X
. A higher hazard coefficient estimate corresponds to a smaller predicted survival time.
predict_hazard(lnr::GLMNetCVSurvivalLearner, X::FeatureInput;
fit_index::Integer)
Returns the fitted hazard coefficient estimate made by the fit at fit_index
on the path for lnr
for each point in the data X
. A higher hazard coefficient estimate corresponds to a smaller predicted survival time.
IAI.predict_expected_survival_time
— Methodpredict_expected_survival_time(lnr::GLMNetCVSurvivalLearner,
X::FeatureInput)
Returns the expected survival time according to the best fit on the path for lnr
for each point in the data X
.
predict_expected_survival_time(lnr::GLMNetCVSurvivalLearner,
X::FeatureInput;
fit_index::Integer)
Returns the expected survival time according to the fit at fit_index
for lnr
for each point in the data X
.