# API Reference

Documentation for the OptimalFeatureSelection public interface.

## Model Details

These functions can be used to query the structure of a OptimalFeatureSelectionLearner. The examples make use of the following learner:

Fitted OptimalFeatureSelectionClassifier:
Constant: -2.96637
Weights:
region==C:  2.89757
score2:     0.0580296
(Higher score indicates stronger prediction for class true)
IAI.get_prediction_constantFunction
get_prediction_constant(lnr::GLMNetCVRegressor)

Return the constant term in the prediction made by the best fit on the path in lnr.

get_prediction_constant(lnr::GLMNetCVRegressor, fit_index::Integer)

Return the constant term in the prediction made by the fit at fit_index on the path in lnr.

get_prediction_constant(lnr::OptimalFeatureSelectionLearner)

Return the constant term in the prediction in the trained lnr.

Example

IAI.get_prediction_constant(lnr)
-2.9663706
IAI.get_prediction_weightsFunction
get_prediction_weights(lnr::GLMNetCVRegressor)

Return the weights for each feature in the prediction made by the best fit on the path in lnr.

get_prediction_weights(lnr::GLMNetCVRegressor, fit_index::Integer)

Return the weights for each feature in the prediction made by the fit at fit_index on the path in lnr.

get_prediction_weights(lnr::OptimalFeatureSelectionLearner)

Return the weights for each feature in the prediction in the trained lnr. The weights are returned as two Dicts, one for numeric features and one for categoric features.

The numeric Dict has key-value pairs of feature names and their corresponding weights in the prediction.

The categoric Dict has key-value pairs of feature names and a corresponding Dict that maps the categoric levels for that feature to their weights in the prediction.

Any feature not included in either Dict has zero weight in the prediction, and similarly, any categoric levels that are not included have zero weight.

Example

numeric_weights, categoric_weights = IAI.get_prediction_weights(lnr)
numeric_weights
Dict{Symbol, Float64} with 1 entry:
:score2 => 0.0580296
categoric_weights
Dict{Symbol, Dict{Any, Float64}} with 1 entry:
:region => Dict("C"=>2.89757)

## Utilities

IAI.variable_importanceMethod
variable_importance(lnr::OptimalFeatureSelectionLearner)

For OptimalFeatureSelectionLearners, the importance is determined using the coefficients in the resulting model after scaling to account for features of different magnitudes.

## Visualization

### Interactive Visualizations

IAI.write_questionnaireMethod
write_questionnaire(f, lnr::OptimalFeatureSelectionLearner; keyword_arguments...)
write_questionnaire(f, grid::GridSearch; keyword_arguments...)

Write interactive questionnaire based on lnr or grid to f in HTML format.

IAI.show_questionnaireMethod
show_questionnaire(lnr::OptimalFeatureSelectionLearner; keyword_arguments...)
show_questionnaire(grid::GridSearch; keyword_arguments...)

Show interactive questionnaire based on lnr or grid in default browser.

IAI.QuestionnaireMethod
Questionnaire(lnr::OptimalFeatureSelectionLearner; keyword_arguments...)

Specifies an interactive questionnaire based on lnr.